Reputation: 265
Searching on internet, in documentation, routes etc, using search box, and I can find only throttling for authentication.
I have create topics for some sections by users in my project and I need them to can do it only 5-10 per this action.
So my question is
Is in laravel something that I can use, any action-throttling, route-throttling, idk, something like this? If it is not then other best ways to apply this in newest Laravel for particular aciton?
Upvotes: 2
Views: 695
Reputation: 8170
Starting from Laravel 5.2, you can use trottle middlware:
In kernel file:
protected $routeMiddleware =
[
.
.
'trottle' => Illuminate/Routing/Middleware/TrottleRequests
]
Use in routes:
Route::middleware('throttle:60,1')->group(function () {
Route::get('/user', function () {
});
});
Upvotes: 0
Reputation: 486
Throttling mostly implemented in API based application, but it is also feasible in web based apps.
If you are using API: Here is the boilerplate that implements API limits.
Git hub: https://github.com/iamrutvik/laravel-5.3-api-seed
API limit Doc: https://github.com/dingo/api/wiki/Rate-Limiting
If you are using web based App, you might want to look into this repo: https://github.com/GrahamCampbell/Laravel-Throttle
See if this helps you, let me know if it works.
Upvotes: 1
Reputation:
Throttling in laravel is mainly used for authentication purpose, like re-captcha and front end validation.
I have attached a link where you can learn more about it. http://miftyisbored.com/a-complete-tutorial-on-login-throttling-and-recaptha-with-laravel-5-3/
Hope this helps. Thanks!
Upvotes: 0