Performance: Query parameters
MEDIUM IMPACT
Query parameters affect server response time and client-side rendering speed by influencing database queries and URL parsing.
Route::get('/products', function (Request $request) { $query = DB::table('products'); if ($category = $request->query('category')) { $query->where('category', $category); } if ($minPrice = $request->query('min_price')) { $query->where('price', '>=', $minPrice); } if ($maxPrice = $request->query('max_price')) { $query->where('price', '<=', $maxPrice); } $products = $query->get(); return view('products.index', ['products' => $products]); });
Route::get('/products', function (Request $request) { $products = DB::table('products') ->where('category', $request->query('category')) ->orWhere('price', '>', $request->query('min_price')) ->orWhere('price', '<', $request->query('max_price')) ->get(); return view('products.index', ['products' => $products]); });
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Unfiltered query parameters causing broad DB queries | N/A | N/A | Blocks rendering due to slow server response | [X] Bad |
| Filtered and validated query parameters with indexed DB columns | N/A | N/A | Fast server response enables quick paint | [OK] Good |