driver(); } /** * Whether captcha is globally enabled for this instance. */ public function enabled(): bool { return (bool) config_cache('captcha.enabled'); } /** * Whether captcha should be enforced on a given surface. * * Requires the global toggle plus the per-surface "active" flag. Supported * surfaces: login, register, forgotpassword, password_reset, * curated_register. */ public function activeOn(string $surface): bool { if (! $this->enabled()) { return false; } return (bool) config_cache('captcha.active.'.$surface); } /** * List of supported driver machine names. * * @return array */ public function available(): array { return ['hcaptcha', 'turnstile', 'cap']; } /** * Validation rules for the active driver, keyed by its response field. * * Merge the result into a controller's rule set to enforce captcha with * whatever provider is currently selected. * * @return array */ public function rules(): array { return [ $this->active()->responseField() => 'required|captcha_verify', ]; } }