2021-03-01 14:52:11 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
2021-05-01 15:02:15 +02:00
|
|
|
use App\Jobs\PurgeNotifications as JobsPurgeNotifications;
|
2021-03-01 14:52:11 +01:00
|
|
|
use Illuminate\Console\Command;
|
|
|
|
|
|
2021-03-21 22:51:19 +01:00
|
|
|
//phpcs:disable Generic.Files.LineLength.TooLong
|
2021-03-01 14:52:11 +01:00
|
|
|
class PurgeNotifications extends Command
|
|
|
|
|
{
|
2021-03-20 14:38:15 +01:00
|
|
|
|
2021-03-01 14:52:11 +01:00
|
|
|
/**
|
|
|
|
|
* The name and signature of the console command.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
protected $signature = 'notifications:purge';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The console command description.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
protected $description = 'Purge the notifications table where the created_at date of a notification is older than 30 days';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Execute the console command.
|
|
|
|
|
*
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public function handle()
|
|
|
|
|
{
|
2021-05-01 15:02:15 +02:00
|
|
|
$this->info('Running the Job, this could take some time.');
|
|
|
|
|
$job = new JobsPurgeNotifications();
|
|
|
|
|
$job->handle();
|
|
|
|
|
$this->info('Job completed');
|
2021-03-01 14:52:11 +01:00
|
|
|
}
|
|
|
|
|
}
|