Answer the question
In order to leave comments, you need to log in
How to organize a check for a running process?
Writing a time tracker. There is a button on pressing which starts the countdown. There is a bug when two pages are open, two counts can be started in turn from them.
Accordingly, in the controller it is necessary to check whether the countdown has already been started before. The question is where to put this check? This is not a form validation or a permission check, and it requires queries to the database.
Through a form request, through gates, through policies, through a simple if, through a validator? When counting, a Time object is created, write scope and check in it? Write your class in App/Services and implement it in the controller?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question