laravel : how to by pass throttle middleware for some routes in

49 Views Asked by At

enter image description here

in my Laravel project These two queries are executing everywhere regarding my route's middleware I need to skip them for some routes how can I do that

I have tried creating "withoutThrottle" middleware in the kernel like this

enter image description here

but it's not working

1

There are 1 best solutions below

0
Othmane Nemli On

You can skip routes by grouping them in your api.php, for example:


Route::wihtouMiddleware(['throttle:api'])->group(function () {
    Route::post('/x', function () {
        // ...
    });
 
    Route::post('/y', function () {
        // ...
    });
});

Or Single Routes:

Route::post('/x', function () {
 // ...
})->wihtouMiddleware(['throttle:api']);