Answers for "how to check if the collection is empty or not in laravel"

PHP
2

laravel check collection not empty

if ($mentor->first()) { } 
if (!$mentor->isEmpty()) { }
if ($mentor->count()) { }
if (count($mentor)) { }
if ($mentor->isNotEmpty()) { }
Posted by: Guest on December-21-2020
0

laravel collection isEmpty

collect([])->isEmpty();

// true
Posted by: Guest on July-24-2021

Code answers related to "how to check if the collection is empty or not in laravel"

Browse Popular Code Answers by Language