clrghouz/app/Console/Commands/MailSend.php

54 lines
1.0 KiB
PHP
Raw Permalink Normal View History

2023-07-26 09:44:07 +00:00
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
use App\Jobs\MailSend as Job;
class MailSend extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'mail:send'
.' {--T|type=normal : Send crash, normal or both mail}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Trigger a poll to each node with mail queued';
/**
* Execute the console command.
*/
2024-05-25 00:33:35 +00:00
public function handle(): int
2023-07-26 09:44:07 +00:00
{
switch ($this->option('type')) {
case 'crash':
Log::info('CML:- Triggering polls to send CRASH mail');
Job::dispatchSync(TRUE);
break;
case 'normal':
Log::info('CML:- Triggering polls to send NORMAL mail');
Job::dispatchSync(FALSE);
break;
case 'all':
Log::info('CML:- Triggering polls to send ALL mail');
Job::dispatchSync(NULL);
break;
default:
$this->error('Specify -T crash, normal or all');
}
2024-05-25 00:33:35 +00:00
return self::SUCCESS;
2023-07-26 09:44:07 +00:00
}
}