/** * Update or Create an entity in repository * * @throws ValidatorException * * @param array $attributes * @param array $values * * @return mixed */ public function updateOrCreate(array $attributes, array $values = []) { $this->applyScope(); if (!is_null($this->validator)) { $this->validator->with($attributes)->passesOrFail(ValidatorInterface::RULE_UPDATE); } $temporarySkipPresenter = $this->skipPresenter; $this->skipPresenter(true); $model = $this->model->updateOrCreate($attributes, $values); $this->skipPresenter($temporarySkipPresenter); $this->resetModel(); event(new RepositoryEntityUpdated($this, $model)); return $this->parserResult($model); }