I make a request:
User::where('uid',$userInfo['uid'])->isEmpty(); I get the error:
BadMethodCallException in Builder.php line 2123: Call to undefined method Illuminate\Database\Query\Builder::isEmpty() Is it even possible to do this?
This method is not in the builder, there are several options:
Through the method exists (the best for me):
if (User::where('uid',$userInfo['uid'])->exists()) { //Запись существует } Through the count method:
if (User::where('uid',$userInfo['uid'])->count() > 0) { //Запись существует } By simple sampling first and checking for null:
$user = User::where('uid',$userInfo['uid'])->first(); if ($user != null) { // Запись существует } Source: https://ru.stackoverflow.com/questions/636786/
All Articles