diff --git a/app/Console/Commands/TicProcess.php b/app/Console/Commands/TicProcess.php index 91583d4..377fd34 100644 --- a/app/Console/Commands/TicProcess.php +++ b/app/Console/Commands/TicProcess.php @@ -13,7 +13,9 @@ class TicProcess extends Command * * @var string */ - protected $signature = 'tic:process {file : TIC file}'; + protected $signature = 'tic:process' + .' {file : TIC file}' + .' {domain? : Domain Name}'; /** * The console command description. @@ -30,7 +32,7 @@ class TicProcess extends Command public function handle() { // Dispatch job. - Job::dispatchSync($this->argument('file')); + Job::dispatchSync($this->argument('file'),$this->argument('domain')); return Command::SUCCESS; } diff --git a/app/Jobs/TicProcess.php b/app/Jobs/TicProcess.php index a406952..270b381 100644 --- a/app/Jobs/TicProcess.php +++ b/app/Jobs/TicProcess.php @@ -12,6 +12,7 @@ use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\Log; use App\Classes\FTN\Tic; +use App\Models\Domain; class TicProcess implements ShouldQueue { @@ -19,13 +20,17 @@ class TicProcess implements ShouldQueue private const LOGKEY = 'JTP'; + private ?Domain $do; + /** * Create a new job instance. * * @param string $file + * @param string|null $domain */ - public function __construct(private string $file) + public function __construct(private string $file,private ?string $domain=NULL) { + $this->do = $domain ? Domain::where('name',$domain)->singleOrFail() : NULL; } /** @@ -43,6 +48,6 @@ class TicProcess implements ShouldQueue unlink($this->file); if ($to->isNodelist()) - NodelistImport::dispatch($to->fo); + NodelistImport::dispatch($to->fo,$this->domain); } } \ No newline at end of file