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