/**
  * Remove the specified Category from storage.
  *
  * @param  int $id
  *
  * @return Response
  */
 public function destroy($id)
 {
     $category = $this->categoryRepository->findCategoryById($id);
     if (empty($category)) {
         $this->throwRecordNotFoundException("Category not found", ERROR_CODE_RECORD_NOT_FOUND);
     }
     $category->delete();
     return Response::json(ResponseManager::makeResult($id, "Category deleted successfully."));
 }
 /**
  * Remove the specified Category from storage.
  *
  * @param  int $id
  *
  * @return Response
  */
 public function destroy($id)
 {
     $category = $this->categoryRepository->findCategoryById($id);
     if (empty($category)) {
         Flash::error('Category not found');
         return redirect(route('categories.index'));
     }
     $category->delete();
     Flash::message('Category deleted successfully.');
     return redirect(route('categories.index'));
 }