Command refactoring - no functional changes

This commit is contained in:
Deon George
2022-06-27 00:14:36 +10:00
parent 0fe65d6187
commit 2495e4675c
12 changed files with 22 additions and 183 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Support\Facades\Log;
use App\Models\Address;
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 {ftn : FTN to Send to}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'EMSI send';
/**
* Execute the console command.
*
* @throws \Exception
*/
public function handle(): void
{
Log::info('Call EMSI send');
$ao = Address::findFTN($this->argument('ftn'));
if (! $ao)
throw new ModelNotFoundException('Unknown node: '.$this->argument('ftn'));
Job::dispatchSync($ao);
}
}