laravel Questions about firstOrCreate method
If it exists, the original data will be returned,
If it does not exist, it will be created
Then how do you know whether what he returns is the original one or the new one?
高洛峰2017-05-16 16:50:21
wasRecentlyCreated
Properties.
$user = User::firstOrCreate($userData);
if($user->wasRecentlyCreated){
// 新用户处理
}