dictRepository = $dictRepositoryEloquent; } /** * @param Request $request * * @return mixed * @throws \Prettus\Repository\Exceptions\RepositoryException */ public function handleList(Request $request) { $this->dictRepository->pushCriteria(new DictCriteria($request)); $this->dictRepository->setPresenter(DictPresenter::class); return $this->dictRepository->searchDictsByPage(); } /** * @param $id * * @return \Illuminate\Database\Eloquent\Model */ public function handleProfile($id) { $this->dictRepository->setPresenter(DictPresenter::class); return $this->dictRepository->searchDictBy($id); } /** * @param array $data * * @return mixed * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function handleStore($data) { $dict = $this->dictRepository->create($data); return $dict; } /** * @param array $data * * @return mixed * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function handleUpdate($data) { $dict = $this->dictRepository->update($data, $data['id']); return $dict; } /** * @param Request $request * * @return mixed * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function handleDelete($id) { return $this->dictRepository->delete($id); } /** * 获取配置参数 * @param $keys * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator|\Illuminate\Support\Collection|mixed */ public function handleConfigs($keys) { return $this->dictRepository->byKeysConfigs($keys); } /** * 获取配置参数 * @param $keys * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator|\Illuminate\Support\Collection|mixed */ public function handleConfig($key) { return $this->dictRepository->byKeysConfig($key); } }