Answer the question
In order to leave comments, you need to log in
How to make an action limit?
There is a controller, it has a method, how can you make a restriction on its execution so that the user can execute it no more than, for example, 5 minutes?
Is there any option other than how to create a table and store the date of the last call in it?
Answer the question
In order to leave comments, you need to log in
Laravel has a ready-made middleware for this - throttle . Plug it in and set it up the way you want.
In the route, add 'middleware' => 'throttle:1,5'
1 - how many times, 5 - how many minutes timeout
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question