From e1ed446f3eb6b9d7479be32bbd69ac56c22af353 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 1 Dec 2024 16:31:07 +1100 Subject: [PATCH] Ensure children() returns addresses in FTN order --- app/Models/Address.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/Models/Address.php b/app/Models/Address.php index 7dd7cfd..a1d5728 100644 --- a/app/Models/Address.php +++ b/app/Models/Address.php @@ -427,17 +427,13 @@ class Address extends Model ->join('zones',['zones.id'=>'addresses.zone_id']) ->join('domains',['domains.id'=>'zones.domain_id']) ->orderBy('domains.name') - ->orderBy('region_id') - ->orderBy('host_id') - ->orderBy('node_id') - ->orderBy('point_id') + ->FTNorder() ->with([ 'zone:zones.id,domain_id,zone_id,active', 'zone.domain:domains.id,name,active,public', ]); } - /** @deprecated use FTN() */ public function scopeFTNOrder($query) { return $query @@ -971,6 +967,7 @@ class Address extends Model ->where('host_id',$this->host_id) ->where('hub_id',$this->id) ->where('id','<>',$this->id) + ->FTNorder() ->get(); // Need to add in points of this hub's nodes @@ -981,6 +978,7 @@ class Address extends Model ->where('host_id',$this->host_id) ->whereIn('node_id',$o->pluck('node_id')) ->where('point_id','<>',0) + ->FTNorder() ->get() ); @@ -1011,6 +1009,7 @@ class Address extends Model return $o ->where('id','<>',$this->id) + ->FTNorder() ->get(); }