ldc-cocotte/routes/ajax-fo.php
Jérémy Munsch 43d63bce2e
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.
2026-11-15 20:01:02 +01:00

26 lines
1,021 B
PHP

<?php
declare(strict_types=1);
use App\Http\Controllers\Fo\Ajax\BasketController;
use App\Http\Controllers\Fo\Ajax\PickupController;
use App\Http\Controllers\Fo\Ajax\ProductsController;
use Illuminate\Support\Facades\Route;
// * PRODUCTS Filtering
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::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');