Move mailer details into a separate table

This commit is contained in:
2023-07-07 23:59:04 +10:00
parent ad4ea699a5
commit ccdce6bb62
12 changed files with 274 additions and 112 deletions

View File

@@ -6,7 +6,7 @@ use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Support\Facades\Log;
use App\Models\Address;
use App\Models\{Address,Mailer};
use App\Jobs\AddressPoll as Job;
class CommBinkpSend extends Command
@@ -25,6 +25,8 @@ class CommBinkpSend extends Command
*/
protected $description = 'BINKP send';
private const ID = 'BINKP';
/**
* Execute the console command.
*
@@ -34,10 +36,12 @@ class CommBinkpSend extends Command
{
Log::info('CBS:- Call BINKP send');
$mo = Mailer::where('name',self::ID)->singleOrFail();
$ao = Address::findFTN($this->argument('ftn'));
if (! $ao)
throw new ModelNotFoundException('Unknown node: '.$this->argument('ftn'));
Job::dispatchSync($ao);
Job::dispatchSync($ao,$mo);
}
}