Laravel – How To Check If A Collection Is Empty
In Laravel, it is a common mistake to use PHP’s empty() function to check if a collection is empty. When empty() is used on an empty array [] the boolean value of true is returned. However, using empty() on a collection can cause unexpected results because when a collection has no values the empty() function …