1//Controller add
2
3public function __construct()
4 {
5 $this->middleware([
6 'auth',
7//About 20 requests per minute to Cotroller and error if there are too many requests
8 'throttle:20,1'
9 ]);
10 }
1//In Laravel we use throttle middleware to restrict the amount of traffic
2//for a given route or group of routes. The throttle middleware accepts two parameters
3//that determine the maximum number of requests that can be made in a given number of minutes.
4//For example:
5//Here 60 is number of requests you can make in 1 minute.
6
7Route::middleware('throttle:60,1')->get('/user', function () {
8 //
9});
10