From 4bbb82690c9f84ab564dc9ff0d925eacf08bf855 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sat, 19 Oct 2024 13:38:55 +1100 Subject: [PATCH] Enable comm:* commands to be run interactively --- app/Console/Commands/CommBinkpSend.php | 8 +++++--- app/Console/Commands/CommEMSISend.php | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/Console/Commands/CommBinkpSend.php b/app/Console/Commands/CommBinkpSend.php index 0fb7b1a..6f9f2e3 100644 --- a/app/Console/Commands/CommBinkpSend.php +++ b/app/Console/Commands/CommBinkpSend.php @@ -16,7 +16,9 @@ class CommBinkpSend extends Command * * @var string */ - protected $signature = 'comm:binkp:send {ftn : FTN to Send to}'; + protected $signature = 'comm:binkp:send' + .'{--N|now : Dont queue}' + .'{ftn : FTN to Send to}'; /** * The console command description. @@ -32,7 +34,7 @@ class CommBinkpSend extends Command * * @throws \Exception */ - public function handle(): void + public function handle() { $ao = Address::findFTN($this->argument('ftn')); if (! $ao) @@ -42,6 +44,6 @@ class CommBinkpSend extends Command $mo = Mailer::where('name',self::ID)->singleOrFail(); - Job::dispatch($ao,$mo); + return ($this->option('now')) ? Job::dispatchSync($ao,$mo) : Job::dispatch($ao,$mo); } } diff --git a/app/Console/Commands/CommEMSISend.php b/app/Console/Commands/CommEMSISend.php index 1afe676..c34a8c1 100644 --- a/app/Console/Commands/CommEMSISend.php +++ b/app/Console/Commands/CommEMSISend.php @@ -16,7 +16,9 @@ class CommEMSISend extends Command * * @var string */ - protected $signature = 'comm:emsi:send {ftn : FTN to Send to}'; + protected $signature = 'comm:emsi:send' + .'{--N|now : Dont queue}' + .'{ftn : FTN to Send to}'; /** * The console command description. @@ -32,7 +34,7 @@ class CommEMSISend extends Command * * @throws \Exception */ - public function handle(): void + public function handle() { $ao = Address::findFTN($this->argument('ftn')); if (! $ao) @@ -42,6 +44,6 @@ class CommEMSISend extends Command $mo = Mailer::where('name',self::ID)->singleOrFail(); - Job::dispatch($ao,$mo); + return ($this->option('now')) ? Job::dispatchSync($ao,$mo) : Job::dispatch($ao,$mo); } }