laravel 8 check for empty collection 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();