public function update(array $data, $id) { try { $this->validator->with($data)->passesOrFail(); $this->repository->update($data, $id); return $this->repository->find($id); } catch (ValidatorException $e) { return ['error' => true, 'message' => $e->getMessageBag()]; } }