Stop N+1 queries before they ship
Problem. A loop that touches a relation fires one query per row. It feels fine with ten rows in development and stalls with ten thousand in production.
Fix. Turn lazy loading into an error everywhere except production, so the slow page fails loudly while you are still building it.
// app/Providers/AppServiceProvider.phppublic function boot(): void{ Model::preventLazyLoading(! app()->isProduction());}Result. The exception names the exact relation to eager load. One line, and the whole team gets the check.