Why does my seeder work with updateOrCreate but only when I include 'email' twice?
12:41 13 May 2026

I have a Laravel seeder for an admin user:

If I remove the second 'email' from the second array (the attributes array), the seeder still runs but the email is missing from the updated record. Why does updateOrCreate require the email to be repeated in both the first and second arrays? Isn't the first array already defining the lookup criteria?

I expected the second array to only contain additional attributes, not repeat the lookup column.

User::updateOrCreate(
    ['email' => 'admin@shoestore.com'],
    [
        'name' => 'Administrator',
        'email' => 'admin@shoestore.com',
        'password' => Hash::make('password123'),
        'email_verified_at' => now(),
    ]
);

laravel laravel-query-builder