Change System::match to return a single item regardless of role
This commit is contained in:
parent
3221d7f679
commit
5b24ff944f
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user