Skip to content

Commit

Permalink
Minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamKyle committed Aug 21, 2024
1 parent 28f83e1 commit 7d93738
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions app/Console/Commands/CheckInactiveSessions.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ public function handle() {
$loggedInAt = Carbon::parse($login->logged_in_at);
$lastHeartbeat = Carbon::parse($login->last_heart_beat); // Correct column name

$login->logged_out_at = Carbon::now();
$login->duration_in_seconds = $lastHeartbeat->diffInSeconds($loggedInAt);
$login->save();
});$threshold = now()->subHour();

UserLoginDuration::whereNull('logged_out_at')
->where('last_heartbeat_at', '<', $threshold)
->get()
->each(function ($login) {
$loggedInAt = Carbon::parse($login->logged_in_at);
$lastHeartbeat = Carbon::parse($login->last_heartbeat_at);

$login->logged_out_at = Carbon::now();
$login->duration_in_seconds = $lastHeartbeat->diffInSeconds($loggedInAt);
$login->save();
Expand Down

0 comments on commit 7d93738

Please sign in to comment.