Laravel has a mechanism to catch the lazy loading, but let me show you one caveat on how it works, and how to PROPERLY enable it.
Links mentioned in the video:
- [Docs] Preventing Lazy Loading: https://laravel.com/docs/11.x/eloquent-relationships#preventing-lazy-loading
- My other videos on the N+1 Query problem: https://www.youtube.com/@LaravelDaily/search?query=n%2B1
- My course "Testing in Laravel For Beginners": https://laraveldaily.com/course/testing-laravel
- - - - -
Support the channel by checking out my products:
- My Laravel courses: https://laraveldaily.com/courses
- Filament examples: https://filamentexamples.com
- Livewire Kit Components: https://livewirekit.com
- - - - -
Other places to follow:
- My weekly Laravel newsletter: https://us11.campaign-archive.com/home/?u=a459401212599a54203d036ee&id=91c1337873
- My personal Twitter: https://twitter.com/povilaskorop