mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-16 16:41:03 +02:00
Add authentication log cleaning and associated tests
This commit is contained in:
@ -28,6 +28,24 @@ class AuthLogFactory extends Factory
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model has login before last year.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\AuthLog>
|
||||
*/
|
||||
public function daysAgo(int $days)
|
||||
{
|
||||
return $this->state(function (array $attributes) use ($days) {
|
||||
$loginDate = now()->subDays($days);
|
||||
$logoutDate = $loginDate->addHours(1);
|
||||
|
||||
return [
|
||||
'login_at' => $loginDate,
|
||||
'logout_at' => $logoutDate,
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model is a failed login.
|
||||
*
|
||||
|
Reference in New Issue
Block a user