How to Check If an Eloquent Collection Is Empty (and Count It Correctly)
count(), isEmpty(), isNotEmpty(), and the N+1-query mistake people make trying to "optimize" an empty check on an Eloquent relationship.
GUIDES
count(), isEmpty(), isNotEmpty(), and the N+1-query mistake people make trying to "optimize" an empty check on an Eloquent relationship.
By default Laravel pagination links drop your filter/sort query params on page 2+. Here is how to keep them with appends() or withQueryString().
whereDate, whereBetween, and raw Carbon comparisons in Eloquent — which one to use and the timezone mistake that causes off-by-one-day bugs.
Changing a column type after it is already in production requires the doctrine/dbal package (or Laravel 11's native alternative) and a real rollback plan.
A working example of uploading an image via AJAX in Laravel with a live browser preview before the request is sent, using FormData and the public disk.
leftJoin() syntax, why it returns null columns instead of dropping rows, and the specific case where it behaves differently from a whereHas() relationship query.
Laravel 11 removed app/Http/Kernel.php — here is how middleware registration actually works now, with a working example.
How to register global helper functions in Laravel 11 and 12, including the composer.json autoload change from older versions.