#v4 registration

6 messages · Page 1 of 1 (latest)

opaque hedge
#

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',
            ]);
    }
}
sturdy muralBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

opaque hedge
#

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,
            ]);
    }
}
viral marlin
#

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

west fiber