categoryRepository = $categoryRepositoryEloquent; } /** * @param Request $request * * @return mixed * @throws \Prettus\Repository\Exceptions\RepositoryException */ public function handleList(Request $request) { $this->categoryRepository->pushCriteria(new CategoryCriteria($request)); $this->categoryRepository->setPresenter(CategoryPresenter::class); return $this->categoryRepository->searchCategorysByPage(); } /** * @param $id * * @return \Illuminate\Database\Eloquent\Model */ public function handleProfile($id) { $this->categoryRepository->setPresenter(CategoryPresenter::class); return $this->categoryRepository->searchCategoryBy($id); } /** * @param array $data * * @return mixed * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function handleStore($data) { $category = $this->categoryRepository->create($data); return $category; } /** * @param array $data * * @return mixed * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function handleUpdate($data) { $category = $this->categoryRepository->update($data, $data['id']); return $category; } /** * @param Request $request * * @return mixed * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function handleDelete($id) { return $this->categoryRepository->delete($id); } }