jobRepository = $jobRepositoryEloquent; } /** * @param Request $request * * @return mixed * @throws \Prettus\Repository\Exceptions\RepositoryException */ public function handleList(Request $request) { $this->jobRepository->pushCriteria(new JobCriteria($request)); $this->jobRepository->setPresenter(JobPresenter::class); return $this->jobRepository->searchJobsByPage(); } /** * @param $id * * @return \Illuminate\Database\Eloquent\Model */ public function handleProfile($id) { $this->jobRepository->setPresenter(JobPresenter::class); return $this->jobRepository->searchJobBy($id); } /** * @param array $data * * @return mixed * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function handleStore($data) { return $this->jobRepository->create($data); } /** * @param array $data * * @return mixed * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function handleUpdate($data) { $job = $this->jobRepository->update($data, $data['id']); return $job; } /** * @param $id * @return int */ public function handleDelete($id) { return $this->jobRepository->delete($id); } /** * 选项数据 * @param Request $request * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator|\Illuminate\Support\Collection|mixed * @throws \Prettus\Repository\Exceptions\RepositoryException */ public function handleSelectOptions(Request $request) { $this->jobRepository->pushCriteria(new JobCriteria($request)); return $this->jobRepository->all([ 'id', 'name', 'code', 'sort', ]); } }