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