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