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