From 43d63bce2ed7a945705e129bef8385fcdb0f7643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Sun, 15 Nov 2026 20:01:02 +0100 Subject: [PATCH] feat(basket): add throttling middleware for basket actions This change introduces a throttling middleware to limit the rate of requests for adding, removing, and emptying the basket, enhancing the application's performance and security. --- routes/ajax-fo.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/routes/ajax-fo.php b/routes/ajax-fo.php index a5d3e922..df0f25f0 100644 --- a/routes/ajax-fo.php +++ b/routes/ajax-fo.php @@ -13,11 +13,14 @@ Route::get('products/filter', ProductsController::class)->name('products.filter' // * BASKET Route::name('basket.')->prefix('basket')->group(function (): void { Route::get('get', [BasketController::class, 'get'])->name('get'); - Route::post('add', [BasketController::class, 'add'])->name('add'); - Route::post('remove', [BasketController::class, 'remove'])->name('remove'); - Route::post('empty', [BasketController::class, 'empty'])->name('empty'); + Route::middleware('throttle:30,1')->group(function (): void { + Route::post('add', [BasketController::class, 'add'])->name('add'); + Route::post('remove', [BasketController::class, 'remove'])->name('remove'); + Route::post('empty', [BasketController::class, 'empty'])->name('empty'); + }); }); // * ORDERS TUNNEL Route::get('/shops/{shop}/pickup-timeslots', [PickupController::class, 'getAvailableTimeslots']) + ->middleware(['auth:frontend', 'verified', 'is-employed']) ->name('shops.pickup-timeslots');