Laravel 5.5 : Dynamically change throttle time
问题 Currently i am working on login throttle, I have to change the throttle time on 2nd throttle dynamically. How will i be able to do that ? 回答1: Middleware (such as throttle ) can be defined inside controllers as well. A solution would be to conditionally set the middleware in the controllers' constructor, something along the lines of: if (true) { $this->middleware('throttle:60,1'); } else { $this->middleware('throttle:30,1'); } In Laravel 5.6, here’s how you specify a User model attribute used