fix: use firstOrCreate instead of factory in seeder to prevent fake() undefined error in production
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user