ldc-legaulois/app/Jobs/PurgeNotifications.php
2021-05-01 15:02:15 +02:00

29 lines
638 B
PHP

<?php
namespace App\Jobs;
use App\Models\Notifications;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class PurgeNotifications implements ShouldQueue
{
use Dispatchable;
use InteractsWithQueue;
use Queueable;
use SerializesModels;
/**
* This is for Laravel Console usage
*/
public $console = null;
public function handle()
{
Notifications::where('created_at', '<', Carbon::now()->subDays(30))->delete();
}
}