53 lines
1.0 KiB
PHP
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 CommBinkpSend extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'comm:binkp:send'
|
|
.'{--N|now : Dont queue}'
|
|
.'{ftn : FTN to Send to}';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'BINKP 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('CBS:- Call BINKP send for %s',$ao->ftn));
|
|
|
|
$mo = Mailer::where('name','BINKP')->sole();
|
|
|
|
if ($this->option('now'))
|
|
Job::dispatchSync($ao,$mo);
|
|
else
|
|
Job::dispatch($ao,$mo);
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
}
|