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