Check if Collection is Empty: isset(), empty() or !$collection?

If your Eloquent Collection returns 0 results, what method is the best to check if it’s empty? Should you use PHP methods, or are there specific Laravel methods for Collections? Let’s try them all practically. Related articles about PHP: - PHP isset() vs empty() vs is_null(): - The Definitive Guide To PHP’s isset And empty: - Using isset() and empty() hurts your code:
Back to Top