clrghouz/app/Console/Commands/MailSend.php
Deon George 3555e5a91c
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 39s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m42s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s
Dont cache the mail:send query
2024-05-25 10:33:35 +10:00

54 lines
1.0 KiB
PHP

<?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.
*/
public function handle(): int
{
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');
}
return self::SUCCESS;
}
}