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