I know the title sounds unclear, so let me start with an example. What would be your Eloquent query if you have birth_date field in DB an want to show how many of your users are adult 18+ years, and how many are still children? Let's take a look.
Many of us are used to write conditional Eloquent queries with "if-else". What if I told you there's a (much) better way? Easily readable and more Laravel-ish.
Title of the article might sound unclear, but let's imagine you have customer list from Customer::all(), but then you need two separate lists/tables - customers from UK and from US. How to avoid two queries here? There's a filter() function.
If you have a complex DB query with multiple AND/OR conditions, there's one mistake you need to avoid. In this video, I will show you what the mistake is, what is the bad result of it, and how to fix it.