Hey, I'm writing a book.  Eloquent Beyond The Basics

🔥 Laravel Tip: Eager loading with limits

Nov 11, 2022

If you try to add a limit when you are eager loading a relationship (ex. get the last 3 posts for each user) you might notice that you don't get the results you expected.

You can solve this using @staudenmeir extension:
https://github.com/staudenmeir/eloquent-eager-limit
tip-image-0