clrghouz/app/Console/Commands/CommEMSISend.php
Deon George 058b4ac4b9
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 2m46s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 3m50s
Create Docker Image / Final Docker Image Manifest (push) Successful in 11s
Fix for 4bbb826 command syntax for Comm* commands was displaying incorrectly
2025-01-07 11:13:31 +11:00

53 lines
1.0 KiB
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Support\Facades\Log;
use App\Models\{Address,Mailer};
use App\Jobs\AddressPoll as Job;
class CommEMSISend extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'comm:emsi:send'
.' {--N|now : Dont queue}'
.' {ftn : FTN to Send to}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'EMSI send';
/**
* Execute the console command.
*
* @throws \Exception
*/
public function handle()
{
$ao = Address::findFTN($this->argument('ftn'));
if (! $ao)
throw new ModelNotFoundException('Unknown node: '.$this->argument('ftn'));
Log::info(sprintf('CES:- Call EMSI send for %s',$ao->ftn));
$mo = Mailer::where('name','EMSI')->sole();
if ($this->option('now'))
Job::dispatchSync($ao,$mo);
else
Job::dispatch($ao,$mo);
return self::SUCCESS;
}
}