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