diff --git a/app/Http/Controllers/FileareaController.php b/app/Http/Controllers/FileareaController.php index 44c273b..93d1a6d 100644 --- a/app/Http/Controllers/FileareaController.php +++ b/app/Http/Controllers/FileareaController.php @@ -26,6 +26,7 @@ class FileareaController extends Controller 'description' => 'required', 'active' => 'required|boolean', 'public' => 'required|boolean', + 'nodelist' => 'nullable|string|max:12' ]); foreach (['name','description','active','public','notes','domain_id'] as $key) @@ -33,6 +34,12 @@ class FileareaController extends Controller $o->save(); + if ($request->post('nodelist')) { + $o->domain->nodelist_filename = $request->post('nodelist'); + $o->domain->nodelist_filearea_id = $o->id; + $o->domain->save(); + } + return redirect()->action([self::class,'home']); } diff --git a/app/Jobs/TicProcess.php b/app/Jobs/TicProcess.php index 713dfc7..a406952 100644 --- a/app/Jobs/TicProcess.php +++ b/app/Jobs/TicProcess.php @@ -41,5 +41,8 @@ class TicProcess implements ShouldQueue Log::info(sprintf('%s:Processed [%s] storing [%s] as id [%d]',self::LOGKEY,$this->file,$to->fo->file,$to->fo->id)); unlink($this->file); + + if ($to->isNodelist()) + NodelistImport::dispatch($to->fo); } } \ No newline at end of file diff --git a/app/Models/Domain.php b/app/Models/Domain.php index f514802..1b3046d 100644 --- a/app/Models/Domain.php +++ b/app/Models/Domain.php @@ -44,6 +44,11 @@ class Domain extends Model return $this->hasMany(Filearea::class); } + public function nodelist_filearea() + { + return $this->belongsTo(Filearea::class); + } + public function zones() { return $this->hasMany(Zone::class); diff --git a/database/migrations/2022_11_03_115325_nodelist.php b/database/migrations/2022_11_03_115325_nodelist.php new file mode 100644 index 0000000..b797ec3 --- /dev/null +++ b/database/migrations/2022_11_03_115325_nodelist.php @@ -0,0 +1,37 @@ +string('nodelist_filename')->nullable(); + + $table->bigInteger('nodelist_filearea_id')->nullable(); + $table->foreign('nodelist_filearea_id')->references('id')->on('fileareas'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('domains', function (Blueprint $table) { + $table->dropForeign(['nodelist_filearea_id']); + + $table->dropColumn(['nodelist_filename','nodelist_filearea_id']); + }); + } +}; diff --git a/resources/views/domain/addedit.blade.php b/resources/views/domain/addedit.blade.php index 604eb71..ec4e3ea 100644 --- a/resources/views/domain/addedit.blade.php +++ b/resources/views/domain/addedit.blade.php @@ -41,6 +41,18 @@ + +