Fix for address <-> children loops
This commit is contained in:
parent
df559b6b39
commit
e28e17866e
@ -116,6 +116,8 @@ class Address extends Model
|
||||
case self::NODE_HC:
|
||||
// Identify our children.
|
||||
$children = self::select('addresses.*')
|
||||
->where('zone_id',$this->zone_id)
|
||||
->where('region_id',$this->region_id)
|
||||
->where('hub_id',$this->id);
|
||||
|
||||
break;
|
||||
@ -136,6 +138,10 @@ class Address extends Model
|
||||
->where('zone_id',$this->zone_id);
|
||||
}
|
||||
|
||||
// I cant have myself as a child, and have a high role than me
|
||||
$children->where('id','<>',$this->id)
|
||||
->where('role','>',$this->role);
|
||||
|
||||
// Remove any children that we have session details for (SAME AS HC)
|
||||
$sessions = self::select('hubnodes.*')
|
||||
->join('system_zone',['system_zone.system_id'=>'addresses.system_id','system_zone.zone_id'=>'addresses.zone_id'])
|
||||
|
Loading…
Reference in New Issue
Block a user