feat(admin): manage captcha configuration centrally

- add a dedicated Filament settings tab for captcha drivers
- persist selections into config-compatible schema and migrate legacy keys
- extend captcha manager to consume database overrides transparently

Signed-off-by: Qi HU <github@spcsky.com>
This commit is contained in:
Qi HU
2025-10-13 12:15:33 +08:00
parent 60e1e45d73
commit ce913b7a54
5 changed files with 274 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Services\Captcha;
use App\Services\Captcha\Exceptions\CaptchaValidationException;
use App\Models\Setting;
use Illuminate\Support\Arr;
class CaptchaManager
@@ -113,6 +114,15 @@ class CaptchaManager
}
$this->config = is_array($config) ? $config : [];
try {
$settings = Setting::get('captcha', []);
if (is_array($settings) && !empty($settings)) {
$this->config = array_replace_recursive($this->config, $settings);
}
} catch (\Throwable $exception) {
// ignore database errors at bootstrap phase
}
}
return Arr::get($this->config, $key, $default);