The result returned by laravel query data
When inserting into the database, it is found that the result returned by the query data is an object; even if the empty data is returned, it is not true or false
So to determine whether the result of the query has a result, what if?
Learning source:
https://douyasi.com/laravel/eloquent_collection_detect_empty.html
https://stackoverflow.com/questions/20563166/eloquent-collection-counting-and-detect-empty
Can't use is_set() empty() to judge because it is true regardless of success or not
$result = Model::where(...)->get(); //不为空则 if ($result->first()) { } if (!$result->isEmpty()) { } if ($result->count()) { }