FWK | Eloquent | Raw queries where Eloquent query builder works | Search for DB::select(), DB::statement(), raw SQL strings in model/service code where Eloquent's query builder (where(), join(), whereHas()) would be cleaner and safer. Exclude complex reporting queries that genuinely need raw SQL. | Minor |
FWK | Eloquent | Missing $casts on model | Model attributes that should be cast (dates, booleans, arrays, JSON) accessed without $casts definition. Look for manual casting in accessors or repeated (bool), (int), json_decode() on model attributes. | Minor |
FWK | Eloquent | Repeated WHERE conditions without scopes | Same where() condition chain used in 3+ locations on the same model. Should be extracted into a named scope (scopeActive(), scopePublished()). | Minor |
FWK | Routing | Logic in route closures instead of controllers | Route definitions in routes/web.php or routes/api.php with closure handlers exceeding 3 lines. Should be moved to controller methods. | Minor |
FWK | Routing | Missing route model binding | Routes that accept an ID parameter and manually call Model::find($id) or Model::findOrFail($id) instead of using route model binding in the method signature. | Minor |
FWK | Validation | Validation in controller instead of Form Request | Controller methods with inline validation rules ($request->validate([...]) exceeding 5 rules). Should use a dedicated Form Request class. | Minor |
FWK | Queues | Long-running tasks in request cycle | Operations likely to take > 5 seconds (sending emails, generating PDFs, calling external APIs, processing uploads) executed synchronously in a controller/request handler. Should be dispatched to a queue. | Major |
FWK | Queues | Queue jobs without retry configuration | Job classes missing $tries, $timeout, or $backoff properties. Jobs will retry indefinitely on failure without these. | Minor |
FWK | Events | Tight coupling where events would decouple | After a state change (create, update, delete), a method directly calls 3+ other services. Should dispatch an event and let listeners handle side effects. | Minor |
FWK | Config | env() called outside config files | Using env() helper directly in service classes, controllers, or blade templates. env() returns null when config is cached. Must be wrapped in a config/ file. | Major |