You can use constrained eager loading to increase performance of database queries that use relations

You can use constrained eager loading to increase performance of database queries that use relations

🔥 #Laravel Tip: Eager loading a model’s relationships is a great way to improve performance / avoid the N+1 problem. However, you can go further… with constrained eager loading you can tell Laravel to only load the related records you actually need.

We're writing a book, you can get it for free here.