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 update(array $data, $id) { try { $this->validator->with($data)->passesOrFail(); //return $this->repository->update($data, $id); if ($this->repository->update($data, $id)) { return ['success' => true, 'message' => 'Tarefa atualizada com sucesso!']; } } catch (ValidatorException $e) { return ['error' => true, 'message' => $e->getMessageBag()]; } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => 'Não foi possível atualizar o membro! Projeto ou membro não encontrado!']; } }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update(Request $request, $id, $memberId) { return $this->repository->update($request->all(), $memberId); // }