Performance: Basic route definition
MEDIUM IMPACT
This affects the initial server response time and how quickly the correct content is delivered to the browser.
Route::get('/home', [HomeController::class, 'index']); // In HomeController: public function index() { $users = User::paginate(10); return view('home', ['users' => $users]); }
Route::get('/home', function () { $users = User::all(); return view('home', ['users' => $users]); });
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Route closure with heavy logic | N/A (server-side) | N/A | N/A | [X] Bad |
| Route to controller with optimized queries | N/A (server-side) | N/A | N/A | [OK] Good |