Performance: CRUD with Eloquent
MEDIUM IMPACT
This affects server response time and database query efficiency, impacting how fast data changes reflect on the page.
<?php User::where('status', '!=', 'active')->update(['status' => 'active']); ?>
<?php $users = User::all(); foreach ($users as $u) { $u->update(['status' => 'active']); } ?>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Loading all records and updating in loop | High (loads all data) | N/A (server-side) | N/A (server-side) | [X] Bad |
| Bulk update with single query | Low (no DOM impact) | N/A (server-side) | N/A (server-side) | [OK] Good |