...
use Filament\Pages\Auth\Register as BaseRegister;
class RegisterPage extends BaseRegister
{
// Override the register method
public function register(): ?RegistrationResponse
{
try {
$this->rateLimit(2);
} catch (TooManyRequestsException $exception) {
Notification::make()
->title(__('filament-panels::pages/auth/register.notifications.throttled.title', [
'seconds' => $exception->secondsUntilAvailable,
'minutes' => ceil($exception->secondsUntilAvailable / 60),
]))
->body(array_key_exists('body', __('filament-panels::pages/auth/register.notifications.throttled') ?: []) ? __('filament-panels::pages/auth/register.notifications.throttled.body', [
'seconds' => $exception->secondsUntilAvailable,
'minutes' => ceil($exception->secondsUntilAvailable / 60),
]) : null)
->danger()
->send();
return null;
}
$data = $this->form->getState();
$user = $this->getUserModel()::create($data);
event(new \Filament\Events\Auth\Registered($user));
$user->assignRole('your role'); // assign role here
$this->sendEmailVerificationNotification($user);
Filament::auth()->login($user);
session()->regenerate();
return app(RegistrationResponse::class);
}
}