Fix when we use newFTN, find the zone/domain if it is provided. Fix packet creation error, where Address::ftn depends on zone_id
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 38s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m43s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s

This commit is contained in:
Deon George 2024-05-27 22:22:38 +10:00
parent 7ef9f2dbd0
commit 643f1197d6

View File

@ -245,10 +245,13 @@ class Address extends Model
public static function newFTN(string $address): self
{
$ftn = self::parseFTN($address);
$do = $ftn['d'] ? Domain::where('name',$ftn['d'])->single() : NULL;
$zo = Zone::where('zone_id',$ftn['z'])
->when($do,fn($query)=>$query->where('domain_id',$do->id))
->single();
$o = new self;
$zo = Zone::where('zone_id',$ftn['z'])->single();
$o->zone_id = $zo?->id;
$o->region_id = $ftn['r'];
$o->host_id = $ftn['n'];