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
|
public function run(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->create([
|
$user = User::firstOrCreate(
|
||||||
|
['email' => 'admin@example.com'],
|
||||||
|
[
|
||||||
'name' => 'Admin',
|
'name' => 'Admin',
|
||||||
'email' => 'admin@example.com',
|
|
||||||
'password' => Hash::make('password'),
|
'password' => Hash::make('password'),
|
||||||
'email_verified_at' => now(),
|
'email_verified_at' => now(),
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
|
|
||||||
$user->assignRole('admin');
|
$user->assignRole('admin');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user