app->isLocal()) { return $next($request); } $schemas = $captchaProvider->getActiveSchemas(); foreach ($schemas as $schema) { $response = $schema->validateResponse(); if ($response['success'] && $schema->verifyDomain($response['hostname'] ?? '', $request->url())) { return $next($request); } event(new FailedCaptcha($request->ip(), $response['message'] ?? null)); throw new HttpException(Response::HTTP_BAD_REQUEST, "Failed to validate {$schema->getId()} captcha data."); } // No captcha enabled return $next($request); } }