/** * Get the current category based on the URL * * @throws Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ protected function getCategory() { $path = $this->request->segment(1); $this->category = Category::findPublicCategory($path); if (!$this->category) { throw new NotFoundHttpException('Category not found.'); } return $this->category; }
protected function getCategory() { $path = $this->segment(1); $this->category = Category::findAdminCategory($path); }
/** * Remove the specified resource from storage. * * @param int $id * @throws Symfony\Component\HttpKernel\Exception\NotFoundHttpException * @return Response */ public function destroy($id) { if (Category::destroy([$id])) { if ($this->request->ajax()) { return ['response' => 'success']; } return redirectTo('/' . Config::get(content . category_base)); } throw new NotFoundHttpException(); }