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->title(trans('$subcategory::$subcategory.names')) ->view('$subcategory::public.subcategory.index') ->data(compact('$subcategories')) ->output(); } /** * Show subcategory's list based on a type. * * @param string $slug * * @return response */ protected function list($type = null) { $subcategories = $this->repository ->pushCriteria(app('Litepie\Repository\Criteria\RequestCriteria')) ->scopeQuery(function($query){ return $query->orderBy('id','DESC'); })->paginate(); return $this->response->title(trans('$subcategory::$subcategory.names')) ->view('$subcategory::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->title($$subcategory->name . trans('$subcategory::$subcategory.name')) ->view('$subcategory::public.subcategory.show') ->data(compact('$subcategory')) ->output(); } }