studentRepository = $studentRepositoryEloquent; } /** * @param Request $request * * @return mixed * @throws \Prettus\Repository\Exceptions\RepositoryException */ public function handleList(Request $request) { $this->studentRepository->pushCriteria(new StudentCriteria($request)); $this->studentRepository->setPresenter(StudentPresenter::class); return $this->studentRepository->searchStudentsByPage(); } /** * @param $id * * @return \Illuminate\Database\Eloquent\Model */ public function handleProfile($id) { $this->studentRepository->setPresenter(StudentPresenter::class); return $this->studentRepository->searchStudentBy($id); } /** * @param array $data * * @return mixed * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function handleStore($data) { $student = $this->studentRepository->create($data); return $student; } /** * @param array $data * * @return mixed * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function handleUpdate($data) { $student = $this->studentRepository->update($data, $data['id']); return $student; } /** * @param Request $request * * @return mixed * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function handleDelete($id) { return $this->studentRepository->delete($id); } public function handleSelectOptions(Request $request) { $this->studentRepository->pushCriteria(new StudentCriteria($request)); return $this->studentRepository->all(['id', 'truename', 'account']); } }