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