newsRepository = $newsRepositoryEloquent; } /** * @param Request $request * * @return mixed * @throws \Prettus\Repository\Exceptions\RepositoryException */ public function handleList(Request $request) { $this->newsRepository->pushCriteria(new NewsCriteria($request)); $this->newsRepository->setPresenter(NewsPresenter::class); return $this->newsRepository->searchNewssByPage(); } /** * @param $id * * @return \Illuminate\Database\Eloquent\Model */ public function handleProfile($id) { $this->newsRepository->setPresenter(NewsPresenter::class); return $this->newsRepository->searchNewsBy($id); } /** * @param array $data * * @return mixed * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function handleStore($data) { $news = $this->newsRepository->create($data); return $news; } /** * @param array $data * * @return mixed * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function handleUpdate($data) { $news = $this->newsRepository->update($data, $data['id']); return $news; } /** * @param Request $request * * @return mixed * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function handleDelete($id) { return $this->newsRepository->delete($id); } }