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

This commit is contained in:
Deon George 2024-05-27 22:22:38 +10:00
parent 7ef9f2dbd0
commit 643f1197d6
1 changed files with 6 additions and 3 deletions

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'];