clrghouz/app/Console/Commands/CommBinkpSend.php
2022-06-27 00:14:36 +10:00

44 lines
829 B
PHP

<?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 CommBinkpSend extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'comm:binkp:send {ftn : FTN to Send to}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'BINKP send';
/**
* Execute the console command.
*
* @throws \Exception
*/
public function handle(): void
{
Log::info('Call BINKP send');
$ao = Address::findFTN($this->argument('ftn'));
if (! $ao)
throw new ModelNotFoundException('Unknown node: '.$this->argument('ftn'));
Job::dispatchSync($ao);
}
}