2021-04-01 10:59:15 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
use Illuminate\Console\Command;
|
2021-06-24 10:16:37 +00:00
|
|
|
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
2021-04-01 10:59:15 +00:00
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
|
2021-09-20 10:39:03 +00:00
|
|
|
use App\Models\Address;
|
|
|
|
use App\Jobs\AddressPoll as Job;
|
2021-04-01 10:59:15 +00:00
|
|
|
|
2022-06-26 14:14:36 +00:00
|
|
|
class CommBinkpSend extends Command
|
2021-04-01 10:59:15 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The name and signature of the console command.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2022-06-26 14:14:36 +00:00
|
|
|
protected $signature = 'comm:binkp:send {ftn : FTN to Send to}';
|
2021-04-01 10:59:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The console command description.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2022-06-26 14:14:36 +00:00
|
|
|
protected $description = 'BINKP send';
|
2021-04-01 10:59:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the console command.
|
|
|
|
*
|
2021-07-02 13:44:01 +00:00
|
|
|
* @throws \Exception
|
2021-04-01 10:59:15 +00:00
|
|
|
*/
|
2021-09-20 10:39:03 +00:00
|
|
|
public function handle(): void
|
2021-04-01 10:59:15 +00:00
|
|
|
{
|
|
|
|
Log::info('Call BINKP send');
|
|
|
|
|
2021-09-20 10:39:03 +00:00
|
|
|
$ao = Address::findFTN($this->argument('ftn'));
|
|
|
|
if (! $ao)
|
2021-06-24 10:16:37 +00:00
|
|
|
throw new ModelNotFoundException('Unknown node: '.$this->argument('ftn'));
|
2021-04-01 10:59:15 +00:00
|
|
|
|
2021-09-20 10:39:03 +00:00
|
|
|
Job::dispatchSync($ao);
|
2021-04-01 10:59:15 +00:00
|
|
|
}
|
|
|
|
}
|