🔥 Laravel Tip: Eager load and filter by a nested relationship
Sep 15, 2022
If you need to filter a model by a nested relationship and also eager load both of the relationships you can create a closure that takes care of the logic and pass it to both `with` and `whereHas`
Edit: Apparently, there is a `withWhereHas` method in core that I miss, in Laravel v9.16.0 and above you can use that instead.
Edit: Apparently, there is a `withWhereHas` method in core that I miss, in Laravel v9.16.0 and above you can use that instead.
Other tips:
🔥 Laravel Tip: Temporary Signed routes
Apr 2, 2022
🔥 Laravel Tip: make method constructor parameters
Apr 16, 2022