How to set request limit in laravel route?

10-Apr-2023

.

Admin

Hello Friends,

Larave provide route fire limit. route set limit using throttle middleware. this middleware have two parameter first is maximum number of requests and second is minute. we can use this middleware in login request. if you have to set limit in login request then use throttle middleware.

how to set API rate limiting in laravel.laravel 7 dynamic rate limiting provides per user request throttle.Same throttle limit counter for all routes.rate limiting specific API routes.How do you limit the number of requests (for example, 10 per day) in a Laravel route/URL?

api.php


Route::middleware('throttle:30,1')->group(function () {

Route::post('login', array('as'=> 'login.post', 'uses' => 'Auth\LoginController@login'));

});

I hope it can help you...

#Laravel