当前位置: 首页>>代码示例>>PHP>>正文


PHP Category::update方法代码示例

本文整理汇总了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');
 }
开发者ID:kakapa,项目名称:erpbox,代码行数:14,代码来源:CategoriesController.php

示例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]));
 }
开发者ID:emadmrz,项目名称:tinker,代码行数:11,代码来源:CategoryController.php

示例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.');
 }
开发者ID:leloulight,项目名称:csci71-FinalProject,代码行数:7,代码来源:CategoriesController.php

示例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;
     }
 }
开发者ID:halidovz,项目名称:restful,代码行数:19,代码来源:MenuCategoryController.php

示例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'));
 }
开发者ID:khanhpnk,项目名称:hocvet,代码行数:20,代码来源:CategoryController.php

示例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');
 }
开发者ID:swantrace,项目名称:laravelblog,代码行数:13,代码来源:CategoriesController.php

示例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);
 }
开发者ID:evendev,项目名称:crazy-painter,代码行数:13,代码来源:CategoriesController.php

示例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' => '分类更新失败, 请重试']);
 }
开发者ID:CaliProject,项目名称:mikenong-dev,代码行数:12,代码来源:ManageController.php

示例9: update

 public function update(Request $request, Category $category)
 {
     $category->update($request->all());
     return redirect('admin/categories');
 }
开发者ID:namnv609,项目名称:tunv-laravel5-tutorial,代码行数:5,代码来源:CategoriesController.php

示例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!');
 }
开发者ID:Tisho84,项目名称:laravel-work,代码行数:11,代码来源:CategoriesController.php

示例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();
 }
开发者ID:vazmer,项目名称:mudrosti-laravel,代码行数:15,代码来源:CategoryController.php

示例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.');
 }
开发者ID:nowarena,项目名称:laravel,代码行数:17,代码来源:CategoriesController.php

示例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');
 }
开发者ID:Tisho84,项目名称:conference,代码行数:21,代码来源:CategoryController.php


注:本文中的app\Category::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。