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 CommEMSISend extends Command
@@ -25,6 +25,8 @@ class CommEMSISend extends Command
*/
protected $description = 'EMSI send';
private const ID = 'EMSI';
/**
* Execute the console command.
*
@@ -32,12 +34,14 @@ class CommEMSISend extends Command
*/
public function handle(): void
{
Log::info('Call EMSI send');
Log::info('CES:- Call EMSI 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);
}
}