ldc-gen-game-web/app/Jobs/DeleteOlds/DeleteOldCustomers.php
2026-10-20 12:27:49 +02:00

23 lines
494 B
PHP

<?php
declare(strict_types=1);
namespace App\Jobs\DeleteOlds;
use App\Models\Customer;
use Illuminate\Support\Facades\Log;
/**
* Delete customers that are older than 36 months
*/
class DeleteOldCustomers
{
/**
* Called when the job will be executed.
*/
public function handle(): void
{
Log::debug(self::class . ' Removing old customers');
Customer::query()->withTrashed()->where('last_connection', '<=', now()->subMonths(36))->forceDelete();
}
}