Filament V3 - How to fill login automatically (local environment)

Search for a command to run...

Fun fact, while deep diving how Claude Code works, I realised some files were stored with a .jsonl format! What’s this, a typo?? 😀 Of course not…. It's a text format where each LINE is a valid JSON object. So why this and not just a JSON array?! Reg...

This apply the dependencies transformations needed, and add the PostCSS config file needed. npm remove @tailwindcss/vite npm remove tailwindcss npm install tailwindcss@3 @tailwindcss/forms npm install postcss autoprefixer cat > postcss.config.js ...

Warning: I just deprecated it. Claude Code is fantastic, it does the same job I wanted to achieve with this. It’s a CLI instead of an UI, but it does 10x or 100x more than the current application situation. Get it here: https://docs.anthropic.com/en/...

I know, Livewire and Tailwind are the base for Filament, and this tutorial is not any hidden gem, but my gut feeling tells me I should write it. It shows few steps of the docs, but many don't get there, and don't even know this is possible. Filament ...

You're reading this, so you want the Login page ready to go in local environments, without having to type in a default user (configured in your seeder). Let's go.
Let's create a Filament Page. Press <enter> for an empty answer, when asked if the page is for a resource.
# Create the page
php artisan make:filament-page Auth/Login
# Remove the generated page view - we won't need it
rm resources/views/filament/pages/auth/login.blade.php
Head to the Login.php page, and have this code inside. We will use the base Login page, and add the extra functionality of filling the form in the local environment.
Of course, adapt the credentials to the ones in your seeder.
<?php
namespace App\Filament\Pages\Auth;
use Filament\Pages\Auth\Login as BasePage;
class Login extends BasePage
{
public function mount(): void
{
parent::mount();
if (app()->environment('local')) {
$this->form->fill([
'email' => 'test@example.com',
'password' => 'password',
'remember' => true,
]);
}
}
}
Next, let's go to the ServiceProvider of your panel. On a fresh install, this will be app/Providers/Filament/AdminPanelProvider.php .
Find the login() method, and add the Page as the argument. Find below a guide for that.
//(...)
->login(\App\Filament\Pages\Auth\Login::class)
//(...)
That's it! When you visit the Login page, it will be automatically filled!
Happy coding, enjoy!