本文整理汇总了PHP中app\Category::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::update方法的具体用法?PHP Category::update怎么用?PHP Category::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Category
的用法示例。
在下文中一共展示了Category::update方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(CategoryFormRequest $request, Category $category)
{
// Update the $category
$category->update($request->all());
flash()->success('Category has been updated');
return redirect('categories');
}
示例2: subCategoryUpdate
/**
* Created By Dara on 14/2/2016
* subCategory update
*/
public function subCategoryUpdate(Category $category, Category $subCategory, Request $request)
{
$this->validate($request, ['name' => 'required']);
$subCategory->update(['name' => $request->input('name')]);
Flash::success(trans('users.subCategoryUpdated'));
return redirect(route('admin.category.subCategory.index', [$category->id]));
}
示例3: update
public function update(Category $category, Request $request)
{
$this->validate($request, $this->rules);
$input = array_except(Input::all(), '_method');
$category->update($input);
return Redirect::route('categories.show', $category->slug)->with('message', 'Project updated.');
}
示例4: update
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
* @return Response
*/
public function update(Request $request, \App\Menu $menu, \App\Category $category)
{
$validation = \Validator::make($request->all(), ['name' => 'min:3']);
if ($validation->fails()) {
return response($validation->errors()->all(), 400);
}
if ($category->accessable($menu)) {
$category->update($request->all());
$category->savePhoto($request->file('photo'));
return $category;
}
}
示例5: update
/**
* Chỉnh sửa
*
* @param Category $category
* @return Response
*/
public function update(Category $category, CategoryRequest $request, ImageInterface $image)
{
$data = $request->all();
if ($request->hasFile('image')) {
// Trước hết cần xóa các file ảnh cũ nếu có
if ($category->image) {
\File::delete(public_path(config("image.paths") . 'categories/large' . $category->image));
}
$image->init($request, 'categories')->save('large');
$data = array_replace($data, ['image' => $image->name]);
}
$category->update($data);
return redirect('admin/category')->with('flash_message', config('blog.message.updated'));
}
示例6: update
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
* @return Response
*/
public function update(CategoryFormRequest $request, Category $category)
{
//
$category->update($request->all());
return redirect('blogs')->with('message', 'The blog has been updated');
}
示例7: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Category $category)
{
$category->update($request->all());
flash()->success('Done!', 'Your category was updated!');
return redirect()->action('Admin\\CategoriesController@show', $category);
}
示例8: updateCategory
/**
* Update a category
*
* @param Request $request
* @param Category $category
* @return \Illuminate\Http\RedirectResponse
*/
public function updateCategory(Request $request, Category $category)
{
$category->update($request->except('_token'));
return $category ? redirect()->back()->with(['status' => 'success', 'message' => '分类已更新']) : redirect()->back()->with(['status' => 'error', 'message' => '分类更新失败, 请重试']);
}
示例9: update
public function update(Request $request, Category $category)
{
$category->update($request->all());
return redirect('admin/categories');
}
示例10: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update(Category $category, CategoryRequest $request)
{
$category->update($request->all());
return redirect('categories')->with('success', 'Category updated!');
}
示例11: update
/**
* Update the specified resource in storage.
*
* @param CategoryRequest $request
* @param Category $category
*
* @return Response
* @internal param int $id
*/
public function update(CategoryRequest $request, Category $category)
{
$category->update($request->all());
flash()->success("Category has been successfully updated!");
return redirect()->back()->withInput();
}
示例12: update
/**
* Update the specified resource in storage.
*
* @param int Categories $category
* @return Response
*/
public function update(Category $category)
{
$inputArr = Input::all();
$parentIdArr = $inputArr['parent_id'];
$deleteParentIdArr = isset($inputArr['delete_parent_id']) ? $inputArr['delete_parent_id'] : array();
$id = $inputArr['category_id'];
$inputArr = array_except($inputArr, array('_method', 'parent_id', 'category_id', 'delete_parent_id'));
$category->update($inputArr);
CategoryParentAndChildren::saveParentChild($parentIdArr, $id, $deleteParentIdArr);
return Redirect::route('categories.edit', [$category->slug])->with('message', 'Category updated.');
}
示例13: update
/**
* Update the specified resource in storage.
*
* @param \App\Http\Requests\CategoryRequest $request
* @param \App\Category $category
* @return \Illuminate\Http\Response
*/
public function update(Requests\CategoryRequest $request, Category $category)
{
DB::transaction(function () use($request, $category) {
$update = ['sort' => $request->get('sort'), 'active' => $request->get('active')];
if ($this->systemAdmin) {
$update['department_id'] = $request->get('department_id');
}
$category->update($update);
foreach ($category->langs as $lang) {
$lang->update(['name' => $request->get('name_' . systemTrans($lang['lang_id']))]);
}
});
return redirect(action('Admin\\CategoryController@index'))->with('success', 'updated');
}