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.
This commit is contained in:
Jérémy Munsch 2026-11-15 20:01:02 +01:00
parent 4dd7cc82fe
commit 43d63bce2e
No known key found for this signature in database
GPG key ID: 2AAECDA6B7330F91

View file

@ -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');