示例#1
0
 /**
  *
  * @param Request $request
  * @param Category $category
  * @return Response
  */
 public function update(Request $request, Category $category)
 {
     // Create an array with the new fields merged
     $data = array_compare($category->toArray(), $request->only(['name']));
     $category->update($data);
     return response($category->transform(), Response::HTTP_OK);
 }
示例#2
0
 /**
  * Update a existing category.
  *
  * @param Category $category
  * @param array $parametars
  * @return Category
  */
 public function updateCategory(Category $category, array $parametars)
 {
     \DB::transaction(function () use($category, $parametars) {
         $category->update($parametars);
     });
     return $category;
 }
 /**
  * Update the specified Category in storage.
  *
  * @param CategoryRequest $request
  *
  * @param Category $category
  * @return Response
  */
 public function update(CategoryRequest $request, Category $category)
 {
     $this->data = $category->update($request->all());
     return $this->handleRedirect($request);
 }