How to checkin and checkout time data save in MySQL using jquery?
.checkin button click to start live time .checkout button click then stop time .And both are save data in MYSQL database...
How to checkin and checkout time data save in MySQL using jquery?
.checkin button click to start live time .checkout button click then stop time .And both are save data in MYSQL database...
you can make an Ajax call to your server, and if you are using Carbon date library in your Laravel app, then use Carbon::now() to log the current checkin and checkout time.
$("button").click(function(){
$.ajax({url: "user/checkin", success: function(result){
// to do
}});
});
$("button").click(function(){
$.ajax({url: "user/checkout", success: function(result){
// to do
}});
});
then at the controller function
public function checkin(Request $request) {
$user = $request->user();
$user->checkin_in = \Carbon::now();
$user->save();
}
new Date().toISOString().slice(0, 19).replace('T', ' ');
Copied from here: Convert JS date time to MySQL datetime