Fix when we use newFTN, find the zone/domain if it is provided. Fix packet creation error, where Address::ftn depends on zone_id
This commit is contained in:
parent
7ef9f2dbd0
commit
643f1197d6
@ -245,10 +245,13 @@ class Address extends Model
|
|||||||
public static function newFTN(string $address): self
|
public static function newFTN(string $address): self
|
||||||
{
|
{
|
||||||
$ftn = self::parseFTN($address);
|
$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;
|
$o = new self;
|
||||||
|
|
||||||
$zo = Zone::where('zone_id',$ftn['z'])->single();
|
|
||||||
|
|
||||||
$o->zone_id = $zo?->id;
|
$o->zone_id = $zo?->id;
|
||||||
$o->region_id = $ftn['r'];
|
$o->region_id = $ftn['r'];
|
||||||
$o->host_id = $ftn['n'];
|
$o->host_id = $ftn['n'];
|
||||||
|
Loading…
Reference in New Issue
Block a user