$registrar->register( $request->string('username')->toString(), $request->string('email')->toString(), $request->string('password')->toString(), ); $account = config('moonwell.registration.require_invite_code') ? $inviteCodes->redeemForRegistration( $request->string('invite_code')->toString(), $request->string('username')->toString(), $register, ) : $register(); } catch (DuplicateGameAccountException|InviteCodeException $exception) { return response()->json([ 'message' => $exception->getMessage(), 'errors' => [ $exception->field => [$exception->getMessage()], ], ], 422); } catch (Throwable $exception) { report($exception); return response()->json([ 'message' => __('Не удалось создать аккаунт. Попробуй снова позже.'), ], 500); } return response()->json([ 'message' => __('Игровой аккаунт успешно создан.'), 'verification_required' => true, 'verification_url' => route('verification.notice'), 'account' => [ 'id' => $account['id'], 'username' => $account['username'], ], ], 201); } }