diff --git a/app/Models/System.php b/app/Models/System.php index 2a403c5..e2b5888 100644 --- a/app/Models/System.php +++ b/app/Models/System.php @@ -213,13 +213,16 @@ class System extends Model */ public function match(Zone $o,int $type=(Address::NODE_HC|Address::NODE_ACTIVE|Address::NODE_PVT|Address::NODE_POINT)): Collection { - return $this->akas + $akas = $this->akas ->where(function($item) use($o) { return ($item->zone_id === $o->id) || ($item->zone->domain_id === $o->domain_id); - }) - ->filter(function($item) use ($type) { - return $item->role & $type; }); + + return ($akas->count() > 1) + ? $akas->filter(function($item) use ($type) { + return $item->role & $type; + }) + : $akas; } /**