allerta-vvf/backend/app/Jobs/RemoveOldIpAddressesFromLog...

28 lines
615 B
PHP
Raw Normal View History

2024-01-10 18:41:52 +01:00
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Models\Log;
use Carbon\Carbon;
class RemoveOldIpAddressesFromLogsJob implements ShouldQueue
2024-01-10 18:41:52 +01:00
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
Log::where('created_at', '<', Carbon::now()->subWeeks(2))
->update(['ip' => null]);
}
}