Nodelist import update
This commit is contained in:
@@ -393,7 +393,7 @@ class Address extends Model
|
||||
*/
|
||||
public function scopeFTN($query)
|
||||
{
|
||||
return $query->select(['zone_id','host_id','node_id','point_id'])
|
||||
return $query->select(['addresses.zone_id','host_id','node_id','point_id'])
|
||||
->with('zone.domain');
|
||||
}
|
||||
|
||||
@@ -775,6 +775,11 @@ class Address extends Model
|
||||
return $this->role & self::NODE_HOLD;
|
||||
}
|
||||
|
||||
public function getIsOwnedAttribute(): bool
|
||||
{
|
||||
return $this->system->is_owned;
|
||||
}
|
||||
|
||||
public function getIsPrivateAttribute(): bool
|
||||
{
|
||||
return (! $this->system->address);
|
||||
@@ -788,12 +793,12 @@ class Address extends Model
|
||||
*/
|
||||
public function getRoleIdAttribute(): int
|
||||
{
|
||||
static $warn= FALSE;
|
||||
static $warn = FALSE;
|
||||
|
||||
$val = ($this->role & self::NODE_ALL);
|
||||
$role = $this->ftn_role();
|
||||
|
||||
if ($this->isRoleOverride()) {
|
||||
if ($this->isRoleOverride($role)) {
|
||||
if (! $warn) {
|
||||
$warn = TRUE;
|
||||
Log::alert(sprintf('%s:! Address ROLE [%d] is not consistent with what is expected [%d] for [%s]',self::LOGKEY,$val,$role,$this->ftn));
|
||||
@@ -1194,10 +1199,10 @@ class Address extends Model
|
||||
return $o;
|
||||
}
|
||||
|
||||
public function isRoleOverride(): bool
|
||||
public function isRoleOverride(int $role=NULL): bool
|
||||
{
|
||||
$val = ($this->role & self::NODE_ALL);
|
||||
$role = $this->ftn_role();
|
||||
$role = $role ?: $this->ftn_role();
|
||||
|
||||
return ($val && ($role !== $val)) || (! $role);
|
||||
}
|
||||
|
@@ -170,6 +170,11 @@ class System extends Model
|
||||
}
|
||||
}
|
||||
|
||||
public function getIsOwnedAttribute(): bool
|
||||
{
|
||||
return $this->users->count();
|
||||
}
|
||||
|
||||
public function getPktMsgsAttribute(?int $val): int
|
||||
{
|
||||
return $val ?: Setup::findOrFail(config('app.id'))->msgs_pkt;
|
||||
|
Reference in New Issue
Block a user