public function update(array $data, $id) { try { $this->validator->with($data)->passesOrFail(); return $this->repository->update($data, $id); } catch (ValidatorException $e) { return ['error' => true, 'message' => $e->getMessageBag()]; } }
public function updateFile($data, $id) { try { $this->validator->with($data)->passesOrFail(); return $this->projectFileRepository->update($data, $id); } catch (ValidatorException $e) { return ["sucess" => false, "message" => $e->getMessageBag()]; } }
public function update(array $data, $id) { try { $this->validator->with($data)->passesOrFail(); return $this->repository->update($data, $id); } catch (ValidatorException $e) { return ['error' => true, 'message' => $e->getMessageBag()]; } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => 'Nota de Projeto não encontrado.']; } }
public function update($data = [], $id, $noteId) { try { $this->validator->with($data)->setId($id)->passesOrFail(); return $this->repository->update($data, $noteId); } catch (ValidatorException $e) { return response()->json(['error' => true, 'message' => $e->getMessageBag()]); } catch (ModelNotFoundException $e) { return response()->json(['error' => true, 'message1' => $e->getMessage(), 'message2' => 'Project Note ID ' . $id . ' nao encontrado.']); } }
/** * @param array $data * @param $projectId * @return array|mixed */ public function create(array $data, $projectId) { try { $data['project_id'] = $projectId; $this->validator->with($data)->passesOrFail(); return $this->repository->create($data); } catch (ValidatorException $e) { return ['error' => true, 'message' => $e->getMessageBag()]; } catch (\Exception $e) { return ["error" => true, "message" => $e->getMessage()]; } }
public function addMember($data) { try { $this->validator->with($data)->passesOrFail(); $result = $this->projectRepository->addMember($data['project_id'], $data['user_id']); return ['success' => $result, "message" => 'Adicionar membro ao projeto.']; } catch (ValidatorException $e) { return ['error' => true, 'message' => $e->getMessageBag(), "messageDev" => 'ValidatorException']; } catch (\Exception $e) { return ["error" => true, "message" => 'Falha ao adicionar membro ao projeto.', "messageDev" => $e->getMessage()]; } }
/** * @param array $data * @param $projectId * @param $fileId * @return array|mixed */ public function update(array $data, $projectId, $fileId) { try { $data['project_id'] = $projectId; $this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_UPDATE); return $this->repository->update($data, $fileId); } catch (ValidatorException $e) { return ['error' => true, 'message' => $e->getMessageBag()]; } catch (\Exception $e) { return ["error" => true, "message" => $e->getMessage()]; } }
public function update(array $data, $taskId) { try { $this->validator->with($data)->passesOrFail(); $task = $this->repository->skipPresenter()->update($data, $taskId); $this->updateProgressProject($task); return $task; } catch (ValidatorException $e) { return ['error' => true, 'message' => $e->getMessageBag()]; } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => 'Tarefa não encontrada.']; } }
public function update(array $data, $fileId) { $this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_UPDATE); if ($data['file'] != NULL) { $this->storage->put($fileId . "." . $data['extension'], $this->fileSystem->get($data['file'])); } else { unset($data['file']); unset($data['extension']); } if (empty($data['name'])) { unset($data['name']); } if (empty($data['description'])) { unset($data['description']); } return $this->repository->update($data, $fileId); }
public function update(array $data, $id) { try { $this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_UPDATE); return $this->repository->update($data, $id); } catch (ValidatorException $e) { return ['error' => true, 'message' => $e->getMessageBag(), "messageDev" => 'ValidatorException']; } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => 'Registro não encontrado.', "messageDev" => $e->getMessage()]; } catch (\Exception $e) { return ["error" => true, "message" => 'Falha ao atualizar dados.', "messageDev" => $e->getMessage()]; } }
/** * Add a new member on a project * @param int $projectId * @param int $memberId * @return mix */ public function addMember($data) { $this->validator->with($data)->passesOrFail(); return $this->repository->addMember($data['project_id'], $data['user_id']); }
public function update(array $data, $id) { $this->validator->with($data)->passesOrFail(); return $this->repository->update($data, $id); }