Add to a service provider (non-production):
Model::preventLazyLoading(! app()->isProduction());
Verify
-
Use a query logger or debugbar to confirm relation queries are minimized
-
Add tests that assert counts or avoid unexpected query spikes
npx skills add https://github.com/jpcaparas/superpowers-laravel --skill laravel:performance-eager-loading
Add to a service provider (non-production):
Model::preventLazyLoading(! app()->isProduction());
Use a query logger or debugbar to confirm relation queries are minimized
Add tests that assert counts or avoid unexpected query spikes