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