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