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