Allowing users to choose usernames requires custom Filament Login and Register forms that accept either username or email authentication, with modified login processes and username support in registration.
To start with this, we have to add a custom login and registration page to our Panel Provider:
app/Providers/Filament/AdminPanelProvider.php:
use App\Filament\Pages\Login;use App\Filament\Pages\Register; // ... class AdminPanelProvider extends PanelProvider{ public function panel(Panel $panel): Panel { return $panel ->default() ->id('admin') ->path('admin') ->login(Login::class) ->registration(Register::class) ->colors([ 'primary' => Color::Amber, ]) // ...
Next, we need to create these two pages:
php artisan make:filament-page Loginphp artisan make:filament-page Register
This will create two files that we can modify and add our custom fields: