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