Ларавел первым или с обратным вызовом
$user = User::where([
'name' => $name,
'email' => $email
])->firstOr(function () use ($name, $email) {
return User::create([
'name' => $name,
'email' => $email,
'password' => bcrypt(Str::random(12))
]);
});
DJ Ultimate Disco Party