fix: use firstOrCreate instead of factory in seeder to prevent fake() undefined error in production
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled

This commit is contained in:
idevakk
2026-03-10 00:48:45 +05:30
parent fe69b4b39a
commit c403f350c2

View File

@@ -15,12 +15,14 @@ class FilamentAdminSeeder extends Seeder
*/
public function run(): void
{
$user = User::factory()->create([
'name' => 'Admin',
'email' => 'admin@example.com',
'password' => Hash::make('password'),
'email_verified_at' => now(),
]);
$user = User::firstOrCreate(
['email' => 'admin@example.com'],
[
'name' => 'Admin',
'password' => Hash::make('password'),
'email_verified_at' => now(),
]
);
$user->assignRole('admin');
}