public function update(array $data, $id_project, $id_file) { try { $this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_UPDATE); $file = $this->repository->update($data, $id_file); return $file; } catch (ValidatorException $e) { return ['error' => true, 'message' => $e->getMessageBag()]; } }
public function update(array $data, $project_id, $task_id) { try { $data['project_id'] = $project_id; $this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_UPDATE); return $this->repository->update($data, $task_id); } catch (ValidatorException $e) { return ['error' => true, 'message' => $e->getMessageBag()]; } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => 'A tarefa que está tentando atualizar não existe']; } }