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