Fix binkp remote closing connection, add/delete session details, menu item this system, minor CSS fixes, move system form editing to individual files

This commit is contained in:
Deon George
2021-07-04 21:47:23 +10:00
parent d56681a187
commit acfde97e79
21 changed files with 1293 additions and 655 deletions

View File

@@ -26,6 +26,12 @@ class Address extends Model
/* RELATIONS */
/**
* Find children dependant on this record
*
* @todo While this is finding children of hubs, we are not currently finding children of Hosts or Regions.
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function children()
{
return $this->belongsTo(self::class,'id','hub_id');
@@ -162,7 +168,7 @@ class Address extends Model
static $session = NULL;
if (is_null($session)) {
$session = (new AddressZone)
$session = (new SystemZone)
->where('zone_id',$this->zone_id)
->where('system_id',$this->system_id)
->single();

View File

@@ -1,10 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AddressZone extends Model
{
protected $table = 'address_zone';
}

View File

@@ -23,6 +23,37 @@ class System extends Model
->orderBy('point_id');
}
/**
* Session Passwords for system
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function sessions()
{
return $this->belongsToMany(Zone::class)
->withPivot(['sespass','pktpass','ticpass','fixpass','zt_ipv4','zt_ipv6']);
}
/**
* If this system is configured as this host
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function setup()
{
return $this->hasOne(Setup::class);
}
/**
* Zones a system has addresses for
*
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
*/
public function zones()
{
return $this->hasManyThrough(Zone::class,Address::class,'system_id','id','id','zone_id');
}
/* GENERAL METHODS */
/**

20
app/Models/SystemZone.php Normal file
View File

@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SystemZone extends Model
{
protected $table = 'system_zone';
public function system()
{
return $this->belongsTo(System::class);
}
public function zone()
{
return $this->belongsTo(Zone::class);
}
}