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