Added FTN list, System View

This commit is contained in:
Deon George
2022-11-25 17:44:03 +07:00
parent 102a972fcb
commit c034ce6cd4
14 changed files with 278 additions and 21 deletions

View File

@@ -176,6 +176,11 @@ class Address extends Model
->withPivot(['sent_at','export_at','packet']);
}
public function echomail_from()
{
return $this->hasMany(Echomail::class,'fftn_id','id');
}
/**
* Files that this address has seen
*

View File

@@ -129,4 +129,24 @@ class Domain extends Model
->orderBy('echoareas.name')
->get();
}
/**
* Determine if this zone is managed by this host
*
* @return bool
*/
public function managed(): bool
{
static $so = NULL;
if (is_null($so))
$so = Setup::findOrFail(config('app.id'));
return $so
->system
->addresses
->where('zone.domain.active',TRUE)
->pluck('zone.domain_id')
->contains($this->id);
}
}

View File

@@ -83,6 +83,29 @@ class System extends Model
return $this->hasManyThrough(Zone::class,Address::class,'system_id','id','id','zone_id');
}
/* ATTRIBUTES */
public function getAccessMethodAttribute(): string
{
switch ($this->method) {
case 23: return sprintf('telnet://%s:%s',$this->address,$this->port);
case 22: return sprintf('ssh://%s:%s',$this->address,$this->port);
case 513: return sprintf('rlogin://%s:%s',$this->address,$this->port);
default:
return $this->method ? sprintf('%s:%s',$this->address,$this->port) : 'No access method available.';
}
}
public function getAccessMailerAttribute(): string
{
switch ($this->mailer_type) {
case Setup::O_BINKP: return sprintf('binkp://%s:%s',$this->mailer_address,$this->mailer_port);
case Setup::O_EMSI: return sprintf('emsi://%s:%s',$this->mailer_address,$this->mailer_port);
default:
return $this->mailer_type ? sprintf('%s:%s',$this->address,$this->port) : 'No mailer available.';
}
}
/* METHODS */
public function echoareas()