ldc-gen-game-web/app/Jobs/DeleteOlds/DeleteOldCustomers.php

23 lines
487 B
PHP

<?php
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.
*
* @return void
*/
public function handle()
{
Log::debug(__CLASS__ . ' Removing old customers');
Customer::query()->withTrashed()->where('last_connection', '<=', now()->subMonths(36))->forceDelete();
}
}