laraveldaily-eloquent-audit
Laravel Eloquent Audit
Analyze a Laravel project's Eloquent usage against proven patterns and performance practices. Scan relevant PHP source files plus migrations, model-related tests, and API/resource code (excluding vendor/, node_modules/, storage/) and produce a structured report of findings with actionable suggestions.
This is NOT a security audit or a full application review. Focus exclusively on Eloquent model configuration, query patterns, relationship usage, serialization, write correctness, and performance.
What to Check
1. N+1 Query Problems
Scan controllers, Livewire components, services, and Blade templates for relationship access without eager loading.
Why it matters: The N+1 problem is the most common Eloquent performance issue. Displaying 30 posts with their authors causes 31 queries (1 for posts + 30 for each author) instead of 2. This multiplies with nested relationships — 30 posts with authors and comments can cause hundreds of queries. The difference between 2 queries and 200 queries is the difference between a fast page and a timeout.