Are you re-coding the entire ticketing system in laravel, or just the time tracker piece?
In general, the approach I would take with just the time tracking piece would probably look something like this:
PHP / Laravel:
- Create a timer event model that stores the user_id, ticket_id, start_time, end_time ( nullable ) and any other metadata that you might need ( category, notes, etc )
- Create an API to create, list and update timer events.
HTML / Javascript
( vue.js would be great for something like this, btw )
- On your frontend, when the page loads, you could query for any active timers for that user and ticket
- If no active timers, show a button to create one. This will generate a new timer event via the API, with now() as the start_time.
- If there is an active timer, just get it's start time and pass it along to your javascript controller.
- Use javascript to calculate how much time has elapsed since the start of the event and continue counting up in the browser.
- Setup a heartbeat loop to automatically ping the server and touch the event model as long as the agent has the browser open. If they forget to end the event, you will have the option of backfilling the last updated timestamp into the end time later on for reporting purposes.
- When the task is complete, they can have a button that will stop the event by calling the api and setting the end_time.
- An additional API call could be made at any point to update any other data along the way ( before or after the event has ended )
The main benefit to this approach is that the timer is kept track on the server side. If the agent closes the browser accidentally, you don't have to worry about losing any of the event information. You also have some flexibility to possibly trigger changes based on actions of the ticket ( like if the agent closes the ticket, you could automatically end any events ).
I dunno if this helps at all. I hope it does. I would love to hear more specifics about the project.