clrghouz/app/Console/Commands/MailSend.php

52 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()
{
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');
}
}
}