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->title(trans('$forum::$question.names')) ->view('$forum::public.question.index') ->data(compact('$questions')) ->output(); } /** * Show question's list based on a type. * * @param string $slug * * @return response */ protected function list($type = null) { $questions = $this->repository ->pushCriteria(app('Litepie\Repository\Criteria\RequestCriteria')) ->scopeQuery(function($query){ return $query->orderBy('id','DESC'); })->paginate(); return $this->response->title(trans('$forum::$question.names')) ->view('$forum::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->title($$question->name . trans('$forum::$question.name')) ->view('$forum::public.question.show') ->data(compact('$question')) ->output(); } }