23 lines
619 B
PHP
23 lines
619 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Services\Auth\PasswordResetCleanupService;
|
|
use Illuminate\Console\Command;
|
|
|
|
class CleanupPasswordResetsCommand extends Command
|
|
{
|
|
protected $signature = 'cleanup:password-resets {--days=30}';
|
|
protected $description = 'Delete password reset requests older than N days.';
|
|
|
|
public function handle(PasswordResetCleanupService $service): int
|
|
{
|
|
$days = (int) $this->option('days');
|
|
$count = $service->cleanup($days > 0 ? $days : 30);
|
|
|
|
$this->info("Deleted {$count} old password reset request(s).");
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
}
|