clrghouz/app/Console/Commands/CommEMSISend.php

44 lines
825 B
PHP
Raw Normal View History

2021-04-01 10:59:15 +00:00
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\ModelNotFoundException;
2021-04-01 10:59:15 +00:00
use Illuminate\Support\Facades\Log;
use App\Models\Address;
use App\Jobs\AddressPoll as Job;
2021-04-01 10:59:15 +00:00
class CommEMSISend extends Command
2021-04-01 10:59:15 +00:00
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'comm:emsi:send {ftn : FTN to Send to}';
2021-04-01 10:59:15 +00:00
/**
* The console command description.
*
* @var string
*/
protected $description = 'EMSI send';
/**
* Execute the console command.
*
* @throws \Exception
2021-04-01 10:59:15 +00:00
*/
public function handle(): void
2021-04-01 10:59:15 +00:00
{
Log::info('Call EMSI send');
$ao = Address::findFTN($this->argument('ftn'));
if (! $ao)
throw new ModelNotFoundException('Unknown node: '.$this->argument('ftn'));
Job::dispatchSync($ao);
2021-04-01 10:59:15 +00:00
}
}