repository = $representative; parent::__construct(); } /** * Show representative'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::$representative.names')) ->view('$representative::public.representative.index') ->data(compact('$representatives')) ->output(); } /** * Show representative'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::$representative.names')) ->view('$representative::public.representative.index') ->data(compact('$representatives')) ->output(); } /** * Show representative. * * @param string $slug * * @return response */ protected function show($slug) { $representative = $this->repository->scopeQuery(function($query) use ($slug) { return $query->orderBy('id','DESC') ->where('slug', $slug); })->first(['*']); return $this->response->title($$representative->name . trans('$representative::$representative.name')) ->view('$representative::public.representative.show') ->data(compact('$representative')) ->output(); } }