taskRepository = $taskRepositoryEloquent; } /** * @param Request $request * * @return mixed * @throws \Prettus\Repository\Exceptions\RepositoryException */ public function handleList(Request $request) { $this->taskRepository->pushCriteria(new TaskCriteria($request)); $this->taskRepository->setPresenter(TaskPresenter::class); return $this->taskRepository->searchTasksByPage(); } /** * @param $id * * @return \Illuminate\Database\Eloquent\Model */ public function handleProfile($id) { $this->taskRepository->setPresenter(TaskPresenter::class); return $this->taskRepository->searchTaskBy($id); } /** * @param array $data * * @return mixed * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function handleStore($data) { $task = $this->taskRepository->create($data); return $task; } /** * @param array $data * * @return mixed * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function handleUpdate($data) { $task = $this->taskRepository->update($data, $data['id']); return $task; } /** * @param Request $request * * @return mixed * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function handleDelete($id) { return $this->taskRepository->delete($id); } }