repository = $subcategory; parent::__construct(); } /** * Show subcategory's list. * * @param string $slug * * @return response */ protected function index() { $subcategories = $this->repository ->pushCriteria(app('Litepie\Repository\Criteria\RequestCriteria')) ->scopeQuery(function($query){ return $query->orderBy('id','DESC'); })->paginate(); return $this->response->setMetaTitle(trans('category::subcategory.names')) ->view('category::public.subcategory.index') ->data(compact('subcategories')) ->output(); } /** * Show subcategory. * * @param string $slug * * @return response */ protected function show($slug) { $subcategory = $this->repository->scopeQuery(function($query) use ($slug) { return $query->orderBy('id','DESC') ->where('slug', $slug); })->first(['*']); return $this->response->setMetaTitle($subcategory->name . trans('category::subcategory.name')) ->view('category::public.subcategory.show') ->data(compact('subcategory')) ->output(); } }