/** * 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->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')); }
/** * 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"); }
/** * Display a listing of the resource. * * @return Response */ public function home() { $categories = $this->categoryRepository->all(); return view('home', compact('categories')); }
/** * 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"); }