/**
  * Handle the event.
  *
  * @param  Events  $event
  * @return void
  */
 public function handle(User $user, $remember)
 {
     $user->online = TRUE;
     $user->save();
     $at = new AuditTrail();
     $at->user_id = $user->_id;
     $at->user_name = $user->name;
     $at->event_name = "Logged in";
     $at->event_description = "";
     $at->event_date = \Carbon::now();
     $at->ip = $_SERVER['REMOTE_ADDR'];
     $at->browser = $_SERVER['HTTP_USER_AGENT'];
     $at->save();
 }
Example #2
0
 public function getLogout()
 {
     $user = \Auth::user();
     $user->online = FALSE;
     $user->save();
     $at = new AuditTrail();
     $at->user_id = $user->_id;
     $at->user_name = $user->name;
     $at->event_name = "Logged Out";
     $at->event_description = "";
     $at->event_date = \Carbon::now();
     $at->ip = $_SERVER['REMOTE_ADDR'];
     $at->browser = $_SERVER['HTTP_USER_AGENT'];
     $at->save();
     \Auth::logout();
     \Session::flush();
     return redirect('/');
 }