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('$subcategory::subcategory.names')) ->view('subcategory::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('subcategory::subcategory.name')) ->view('subcategory::subcategory.show') ->data(compact('subcategory')) ->output(); } }