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