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