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