을 만 사용자 데이터를 읽지 않고 존재를 확인해야하는 경우, 더 효율적인 방법은 다음과 같습니다
$exists=User::where('email', $email)->whereNotNull('username')->exists();
if ($exists) {
//User exists. No other data about it.
}
그것을 확인하고 경우에만 자신의 데이터를 읽으려면 존재 :
$user = User::where('email', $email)->whereNotNull('username')->first();
if (!$user) {
//Not found with username, maybe exists without it
}
확인 후 데이터를 어쨌든 그것을 읽고하려면
$user = User::where('email', $email)->first();
if (!$user->username) {
//Does not exists even without username
}else if (!$user->username) {
//Exists but without username
}else{
//Exists with username
}
완벽하게 작동합니다. 감사합니다. – JL9