/**
  * Update the specified Category in storage.
  *
  * @param  int    $id
  * @param Request $request
  *
  * @return Response
  */
 public function update($id, Request $request)
 {
     $category = $this->categoryRepository->findCategoryById($id);
     if (empty($category)) {
         $this->throwRecordNotFoundException("Category not found", ERROR_CODE_RECORD_NOT_FOUND);
     }
     $input = $request->all();
     $category = $this->categoryRepository->update($category, $input);
     return Response::json(ResponseManager::makeResult($category->toArray(), "Category updated successfully."));
 }
 /**
  * Update the specified Category in storage.
  *
  * @param  int    $id
  * @param CreateCategoryRequest $request
  *
  * @return Response
  */
 public function update($id, CreateCategoryRequest $request)
 {
     $category = $this->categoryRepository->findCategoryById($id);
     if (empty($category)) {
         Flash::error('Category not found');
         return redirect(route('categories.index'));
     }
     $category = $this->categoryRepository->update($category, $request->all());
     Flash::message('Category updated successfully.');
     return redirect(route('categories.index'));
 }