So here is the use case:
You have users and they have many addresses. Say you want to filter and eager load on addresses (say...only US addresses). In order to do so you have to filter the eager load AND filter using whereHas
so your result set is only those users with US addresses and only their US addresses are returned. This seems a bit clunky.
Here is an example:
(new App\User)
->with(['address' => function(){/* filter code */}])
->whereHas('address', function(){/* pretty much the same filter code */})
->get()
Is there a better way to do this? I feel like I am missing something.