spatie / laravel-medialibrary

Associate files with Eloquent models
https://spatie.be/docs/laravel-medialibrary
MIT License
5.74k stars 1.07k forks source link

Make media lazy loading configurable #3627

Closed alidevweb closed 3 months ago

alidevweb commented 4 months ago

References

Related issue: https://github.com/spatie/laravel-medialibrary/issues/3554

Story

In our legacy admin we noticed a lot of lazy loaded media relations that causes an n+1 issue silently without throwing an exception even with Model::preventLazyLoading() enabled globally.

The related issue referenced above gives more details.

Changes

alidevweb commented 3 months ago

Hi Spatie team, any feedback on this PR? Thanks

freekmurze commented 3 months ago

Thank you!