R
R
raingo2018-10-25 08:04:50
Laravel
raingo, 2018-10-25 08:04:50

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

1 answer(s)
A
Alexey Nikolaev, 2018-10-25
@raingo

Through Middleweir.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question