php check if collection is empty code example
Example 1: laravel check collection not empty
if ($mentor->first()) { }
if (!$mentor->isEmpty()) { }
if ($mentor->count()) { }
if (count($mentor)) { }
if ($mentor->isNotEmpty()) { }
Example 2: collection empty laravel
$isempty = $collection->isEmpty();