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