cvairlis wrote a reply+100 XP
3mos ago
This worked for me
<?php
namespace App\Filament\Pages\Auth;
use Coderflex\FilamentTurnstile\Forms\Components\Turnstile;
use Filament\Forms\Components\Field;
use Filament\Auth\Pages\Register as BaseRegister;
use Filament\Schemas\Schema;
use Illuminate\Database\Eloquent\Model;
class Register extends BaseRegister
{
public function form(Schema $schema): Schema
{
return $schema
->components([
$this->getNameFormComponent(),
$this->getEmailFormComponent(),
$this->getPasswordFormComponent(),
$this->getPasswordConfirmationFormComponent(),
$this->getTurnstileFormComponent(),
]);
}
protected function getTurnstileFormComponent(): Field
{
return Turnstile::make('cf-turnstile-response')
->label('Captcha Verification')
->size('normal');
}
protected function handleRegistration(array $data): Model
{
$user = parent::handleRegistration($data);
// Auto-assign provider role
$user->assignRole('provider');
return $user;
}
}
cvairlis liked a comment+100 XP
3mos ago