xxxxxxxxxx
// Make some action if the collection is not empty
if ($collection->isNotEmpty()) {
// Do something
}
xxxxxxxxxx
if ($mentor->first()) { }
if (!$mentor->isEmpty()) { }
if ($mentor->count()) { }
if (count($mentor)) { }
if ($mentor->isNotEmpty()) { }
xxxxxxxxxx
$collection = collect([]);
if ($collection->isEmpty()) {
echo "The collection is empty";
} else {
echo "The collection is not empty";
}