From e65e66479219961d16873d3b3c18a4b254fcb172 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 21 Jun 2024 14:44:28 +1000 Subject: [PATCH] Add system_id when listing AKAs, so that we can reference the system relation. --- app/Models/Address.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Models/Address.php b/app/Models/Address.php index 703fcbb..0de732c 100644 --- a/app/Models/Address.php +++ b/app/Models/Address.php @@ -395,7 +395,8 @@ class Address extends Model */ public function scopeFTN($query) { - return $query->select(['id','addresses.zone_id','host_id','node_id','point_id']) + return $query + ->select(['id','addresses.zone_id','host_id','node_id','point_id','system_id']) ->with([ 'zone:zones.id,domain_id,zone_id', 'zone.domain:domains.id,name', @@ -602,9 +603,13 @@ class Address extends Model public function nodes_hub(): HasMany { return $this->hasMany(Address::class,'hub_id','id') - ->FTN() + ->select(['id','addresses.zone_id','host_id','node_id','point_id','system_id']) ->active() - ->FTNorder(); + ->FTNorder() + ->with([ + 'zone:zones.id,domain_id,zone_id', + 'zone.domain:domains.id,name', + ]); } /**