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