Basic Usage
The usage of this plugin, is really straight - forward. In your form, use the following code:
1...2use Coderflex\FilamentTurnstile\Forms\Components\Turnstile;3 4...5 Turnstile::make('captcha')6 ->theme('auto')7 ->language('fr')8 ->size('normal'),
The Turnstile
field, has few options to use. You can learn more about them in the Cloudflare configuration section
Real Life Example:
In order to use Turnstile captcha with the Login
page in filament, use the following steps:
Create a new App/Filament/Pages/Login.php
class
1<?php 2 3namespace App\Filament\Pages; 4 5use Coderflex\FilamentTurnstile\Forms\Components\Turnstile; 6 7class Login extends \Filament\Http\Livewire\Auth\Login 8{ 9 protected function getFormSchema(): array10 {11 return array_merge(12 parent::getFormSchema(),13 [14 Turnstile::make('cf-captcha')15 ->theme('auto')16 ->language('en-US')17 ->size('normal'),18 ]19 );20 }21}
Then override the Login
class in the filament.php
config file.
1return [ 2 .... 3 'auth' => [ 4 'guard' => env('FILAMENT_AUTH_GUARD', 'web'), 5 'pages' => [ 6 'login' => \App\Filament\Pages\Login::class, 7 ], 8 ], 9 ...10]