Laravel zuerst oder mit Rückruf

$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