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