captchaGenerateService->generate(); if ($captcha->isError()) { return $captcha; } $modelCaptcha = DB::transaction(function () use ($captchaPublicToken) { return $this->captchaHandler->handleStore($captchaPublicToken->getCaptchaToken(), $captchaPublicToken->getHttpUserData()); }); $captchaKey = $this->dataCaptchaRepository->store($modelCaptcha, $captcha->getImageBody()->getCoordinators(), $expires); } catch (\Throwable $e) { report($e); return $this->errService('Captcha service error!'); } return new Captcha( imageHead: $captcha->getImageHead()->getImage(), imageBody: $captcha->getImageBody()->getImage(), key: $captchaKey ); } }