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.
26 lines
1,021 B
PHP
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');
|