v4 registration

I installed Filamentphp v4 and want to add two new fields to the Panel register page. The code that worked in v3 does not work in v4. I am not getting any error messages! Register.php
<?php
namespace App\Filament\Tenant\Pages\Auth;
use Filament\Auth\Pages\Register as PagesRegister;
class Register extends {
protected function getForms(): array {
return [
'form' => $this->form(
$this->makeForm()
->components([
$this->getFirstNameFormComponent(),
$this->getLastNameFormComponent(),
$this->getEmailFormComponent(),
$this->getPasswordFormComponent(),
$this->getPasswordConfirmationFormComponent(),
])
->statePath('data'),
),
];
}
protected function getFirstNameFormComponent(): Component {
return TextInput::make('first_name')->required()->autocomplete('off')->live()
->extraAttributes([
'autocapitalize' => 'words',
]);
}
protected function getLastNameFormComponent(): Component {
return TextInput::make('last_name')->required()->autocomplete('off')->live()
->extraAttributes([
'autocapitalize' => 'words',
]);
}
}
<?php
namespace App\Filament\Tenant\Pages\Auth;
use Filament\Auth\Pages\Register as PagesRegister;
class Register extends {
protected function getForms(): array {
return [
'form' => $this->form(
$this->makeForm()
->components([
$this->getFirstNameFormComponent(),
$this->getLastNameFormComponent(),
$this->getEmailFormComponent(),
$this->getPasswordFormComponent(),
$this->getPasswordConfirmationFormComponent(),
])
->statePath('data'),
),
];
}
protected function getFirstNameFormComponent(): Component {
return TextInput::make('first_name')->required()->autocomplete('off')->live()
->extraAttributes([
'autocapitalize' => 'words',
]);
}
protected function getLastNameFormComponent(): Component {
return TextInput::make('last_name')->required()->autocomplete('off')->live()
->extraAttributes([
'autocapitalize' => 'words',
]);
}
}
3 Replies
realinkmind
realinkmindOP2mo ago
Panel Provider
<?php
namespace App\Providers\Filament;
use App\Filament\Tenant\Pages\Auth\Register;
class TenantPanelProvider extends PanelProvider {
public function panel(Panel $panel): {
return $panel
->id('tenant')
->path('tenant')
->colors([
'primary' => Color::Blue,
])
->login()
->registration(Register::class)
->topNavigation()
->discoverResources(in: app_path('Filament/Tenant/Resources'), for: 'App\Filament\Tenant\Resources')
->discoverPages(in: app_path('Filament/Tenant/Pages'), for: 'App\Filament\Tenant\Pages')
->pages([
Dashboard::class,
])
->discoverWidgets(in: app_path('Filament/Tenant/Widgets'), for: 'App\Filament\Tenant\Widgets')
->widgets([
AccountWidget::class,
FilamentInfoWidget::class,
])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authMiddleware([
Authenticate::class,
]);
}
}
<?php
namespace App\Providers\Filament;
use App\Filament\Tenant\Pages\Auth\Register;
class TenantPanelProvider extends PanelProvider {
public function panel(Panel $panel): {
return $panel
->id('tenant')
->path('tenant')
->colors([
'primary' => Color::Blue,
])
->login()
->registration(Register::class)
->topNavigation()
->discoverResources(in: app_path('Filament/Tenant/Resources'), for: 'App\Filament\Tenant\Resources')
->discoverPages(in: app_path('Filament/Tenant/Pages'), for: 'App\Filament\Tenant\Pages')
->pages([
Dashboard::class,
])
->discoverWidgets(in: app_path('Filament/Tenant/Widgets'), for: 'App\Filament\Tenant\Widgets')
->widgets([
AccountWidget::class,
FilamentInfoWidget::class,
])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authMiddleware([
Authenticate::class,
]);
}
}
Dan Harrin
Dan Harrin2mo ago
check the changes to the base class that were made between filament 3 and 4 i dont think getForms is used anymore, i might be wrong
10littlesoldiers
@realinkmind for v4 you can look at the Register Auth class here: https://github.com/filamentphp/filament/blob/4.x/packages/panels/src/Auth/Pages/Register.php
GitHub
filament/packages/panels/src/Auth/Pages/Register.php at 4.x · fila...
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire - filamentphp/filament

Did you find this page helpful?