I am building an application with Laravel 5, and I must have a module to save and update the user's login hours.
I am new to programming, so I'm going crazy about the logic of how to do this.
This is for call center agents. Their shift is between. 3pm to 6amSo, for example, they go in with a timestamp 2015-07-21 03:00:00, which 3pm, and then if they log out 4pm, they have 1.0hours of logging in, then they go in 7pmand go out again 5am of 2015-07-21, then this will be their previous hour of logging in, which 1.0+ 10.0because of 7pm 2015-07-20 - 5am 2015-07-21. And should update the login hours of this user.
How can i do this? So now I have a table in my database that
logihours
->id
->user_id
->loginhours (double/float)
->timestamp (timestamp of last login/logout)
->status (if currently logged in or logged out
That is, now, of course, I need to always check my functions loginand logout, but I don’t know where to start.
source
share