Minor optimisations when editing and viewing domains
This commit is contained in:
@@ -115,9 +115,10 @@ class System extends Model
|
||||
public function sessions()
|
||||
{
|
||||
return $this->belongsToMany(Zone::class)
|
||||
->select(['id','zones.zone_id','domain_id','active'])
|
||||
->select(['zones.id','zones.zone_id','domain_id','zones.active'])
|
||||
->join('domains',['domains.id'=>'zones.domain_id'])
|
||||
->withPivot(['sespass','pktpass','ticpass','fixpass','zt_ipv4','zt_ipv6','default'])
|
||||
->dontCache();
|
||||
->orderBy('domains.name');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -301,6 +302,13 @@ class System extends Model
|
||||
}
|
||||
}
|
||||
|
||||
public function inDomain(Domain $o): bool
|
||||
{
|
||||
return $this->addresses
|
||||
->filter(fn($item)=>$item->zone->domain_id === $o->id)
|
||||
->count() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the system's address in the same zone
|
||||
* This function can filter based on the address type needed.
|
||||
|
Reference in New Issue
Block a user