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