Make email unique (#5978)

When seeding large amounts of users there is a chance for a duplicate entry SQL error because the email column is unique. 64e0175398/database/migrations/2014_10_12_000000_create_users_table.php (L19)
This commit is contained in:
Martin Ro
2022-09-02 22:10:54 +08:00
committed by GitHub
parent 64e0175398
commit ad219e82aa

View File

@@ -19,7 +19,7 @@ class UserFactory extends Factory
{ {
return [ return [
'name' => fake()->name(), 'name' => fake()->name(),
'email' => fake()->safeEmail(), 'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(), 'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10), 'remember_token' => Str::random(10),