Laravel Routing: Rate Limiting

Route::middleware('auth:api', 'throttle:rate_limit,1')->group(function () {
    Route::get('/user', function () {
        //
    });
});

Laravel includes a middleware  to rate limit access to routes within your application.

Dynamic Rate Limiting

Route::middleware('auth:api', 'throttle:rate_limit,1')->group(function () {
    Route::get('/user', function () {
        //
    });
});

You may specify a dynamic request maximum based on an attribute of the authenticated User model.

Laravel Routing: Rate Limiting — Structure map

Clickable & Draggable!

Laravel Routing: Rate Limiting — Related pages: