in my project symfony 5 php 8 , i want a countdown timer 10 minute when user do a action like post a article. when countdown timer is active the user can't post a article, i want like :
If user disconnect the countdown continue that not reset the countdown,the reset will be when countdown finish. I want everything to be automated The start of countdown and the reset.
I tryed to create a command to check Timer (in entity i created a time type property) i aslo i run a cron to execute, but i think i can do better but i don't know i looked everyhere.
I just ask you to guide me, don't help me with code u can but just guide me. Thank you
CodePudding user response:
You can add property createdAt with Datetime in your Post entity. Then you can create Voter with custom logic to check the condition (in your case - time difference). The Voter should be added to the controller.