custom registration form in filament

Maybe this is a stupid question, but it is not clear to me from the official documentation how to do it. I want to customize the default registration form in filamentPHP. to add new fields. In this part of the documentation: https://filamentphp.com/docs/3.x/panels/users#customizing-the-authentication-features I don't understand this part very well:
you can pass in any Filament page class to these methods. Most people will be able to make their desired customizations by extending the base page class from the Filament codebase (...) This class extends the base profile page class from the Filament codebase. Other page classes you could extend include: Filament\Pages\Auth\Login Filament\Pages\Auth\Register Filament\Pages\Auth\EmailVerification\EmailVerificationPrompt Filament\Pages\Auth\PasswordReset\RequestPasswordReset Filament\Pages\Auth\PasswordReset\ResetPassword
I don't have any Pages folder currently in my Filament folder, should I create it by hand? should I create a custom page? it seems confusing to me. Thanks in advance
Solution:
my whole code in case it can help someone (you also have to specify in your panelProvider the registration form you want to use, in my case i added: ->registration(Register::class) and the whole code of mi Register.php file: ...
Jump to solution
2 Replies
Irissu
IrissuOP3w ago
i've created manually a file called Register in this path that didn't exists before > Filament\Pages\Auth\Register. I don't know if is the best way to do it,.. but it works.
Solution
Irissu
Irissu3w ago
my whole code in case it can help someone (you also have to specify in your panelProvider the registration form you want to use, in my case i added: ->registration(Register::class) and the whole code of mi Register.php file: <?php namespace App\Filament\Pages\Auth; use Filament\Forms\Components\Hidden; use Filament\Forms\Components\TextInput; use Filament\Forms\Form; use Filament\Pages\Auth\Register as BaseRegister; class Register extends BaseRegister { public function form(Form $form): Form { return $form ->schema([ $this->getNameFormComponent(), TextInput::make('surname') ->label('Apellidos') ->required(), $this->getEmailFormComponent(), $this->getPasswordFormComponent(), $this->getPasswordConfirmationFormComponent(), TextInput::make('phone') ->label('Teléfono') ->numeric() ->length(9) ->required(), TextInput::make('address') ->label('Dirección'), Hidden::make('role') ->default('owner'), ]); } } ?>

Did you find this page helpful?