/**
  * 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."));
 }
예제 #2
0
 /**
  * Remove the specified Category from storage.
  *
  * @param  int $id
  *
  * @return Response
  */
 public function destroy($id)
 {
     $category = $this->categoryRepository->find($id);
     if (empty($category)) {
         Flash::error('Category not found');
         return redirect(route('categories.index'));
     }
     $this->categoryRepository->delete($id);
     Flash::success('Category deleted successfully.');
     return redirect(route('categories.index'));
 }
예제 #3
0
 /**
  * Remove the specified Category from storage.
  * DELETE /categories/{id}
  *
  * @param  int $id
  *
  * @return Response
  */
 public function destroy($id)
 {
     $this->categoryRepository->apiDeleteOrFail($id);
     return $this->sendResponse($id, "Category deleted successfully");
 }
예제 #4
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function home()
 {
     $categories = $this->categoryRepository->all();
     return view('home', compact('categories'));
 }
예제 #5
0
 /**
  * Remove the specified Category from storage.
  * DELETE /categories/{id}
  *
  * @param  int $id
  *
  * @return Response
  */
 public function destroy($id)
 {
     $this->categoryRepository->apiDeleteOrFail($id);
     header("Access-Control-Allow-Origin:" . $this->clientURL);
     return $this->sendResponse($id, "Category deleted successfully");
 }