Laravel primeiro ou com retorno de chamada

$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