check if collection empty in laravel 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();