repository = $subcategories; parent::__construct(); } /** * Show subcategories'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::$subcategories.names')) ->view('$subcategory::public.subcategories.index') ->data(compact('$subcategories')) ->output(); } /** * Show subcategories'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::$subcategories.names')) ->view('$subcategory::public.subcategories.index') ->data(compact('$subcategories')) ->output(); } /** * Show subcategories. * * @param string $slug * * @return response */ protected function show($slug) { $subcategories = $this->repository->scopeQuery(function($query) use ($slug) { return $query->orderBy('id','DESC') ->where('slug', $slug); })->first(['*']); return $this->response->title($$subcategories->name . trans('$subcategory::$subcategories.name')) ->view('$subcategory::public.subcategories.show') ->data(compact('$subcategories')) ->output(); } }