Have it send a request (poll) to the backend every 5 seconds, to check if it is allowed to show the food as available.
If you do it in the frontend alone, you allow the user to work around it (if they know what they are doing)
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello everyone,
I am building a small task like dashboard.
Technologies: Laravel, Vuejs, Vuex
The page gets two types of categories from the database: plates and foods for example, and creates two lists with every option displayed like a button.
A user will choose the plate first from the top list and match it with a food on the bottom list, and press the add button to save the action.
The requirement is that the type of food needs to be disabled for a period of time specified buy the admin like 3 minutes.
So once the user selects a food, that food can't be selected for 3 minutes, once the time is over the food option unlocks.
I can't figure out a good way to handle this situation that will not break with a page refresh, any ideas are welcome!
Why not just set expire time in a table for specifically this (user, food and expiration) and check against it every time it polls. You can clear old entries every 10 minutes or so using a task (or if the poll find it is expired)
Please or to participate in this conversation.