Laravel Pro Tips
#eloquent #eager loading #n+1
🔥 #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.
Matt Kingshott
#models #lazy loading #n+1
🔥 #Laravel Tip: Protect your database from the dangers of lazy loading by disabling it in your Laravel app. You can also customise how violations are handled, which is perfect for models outside of your control e.g. within packages.
#eloquent #models #lazy loading #n+1
3️⃣ You can enable or disable lazy loading for a model using $preventsLazyLoading
Marian Pop 🇺🇦 Laravel Magazine
No articles were found.