Created
January 3, 2020 08:39
-
-
Save thannaske/2422ede6d64d77f0ea70827b1b63e202 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Allow up to 60 requests in 1 minute for that route (= 1 req/s) | |
Route::get('api/v1/user', 'Api\UserController@index')->middleware('throttle:60,1'); | |
// Allow up to 60 requests in 60 minutes for that route (= 1 req/m) | |
Route::post('api/v1/user', 'Api\UserController@store')->middleware('throttle:60,60'); | |
// Rate Limiting for a whole group of routes | |
Route::group(['middleware' => 'throttle:60,1'], function () { | |
// [...] | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment