2019-07-28 06:11:04 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2021-03-31 17:28:47 +02:00
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
2019-07-28 06:11:04 +02:00
|
|
|
use LibreNMS\Interfaces\Models\Keyable;
|
|
|
|
|
2022-01-20 15:15:23 +01:00
|
|
|
class MplsSap extends DeviceRelatedModel implements Keyable
|
2019-07-28 06:11:04 +02:00
|
|
|
{
|
|
|
|
protected $primaryKey = 'sap_id';
|
|
|
|
public $timestamps = false;
|
|
|
|
protected $fillable = [
|
|
|
|
'svc_id',
|
|
|
|
'svc_oid',
|
|
|
|
'sapPortId',
|
|
|
|
'ifName',
|
|
|
|
'sapEncapValue',
|
|
|
|
'device_id',
|
|
|
|
'sapRowStatus',
|
|
|
|
'sapType',
|
|
|
|
'sapDescription',
|
|
|
|
'sapAdminStatus',
|
|
|
|
'sapOperStatus',
|
|
|
|
'sapLastMgmtChange',
|
|
|
|
'sapLastStatusChange',
|
|
|
|
];
|
|
|
|
|
|
|
|
// ---- Helper Functions ----
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a string that can identify a unique instance of this model
|
2021-09-10 20:09:53 +02:00
|
|
|
*
|
2019-07-28 06:11:04 +02:00
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getCompositeKey()
|
|
|
|
{
|
|
|
|
return $this->svc_oid . '-' . $this->sapPortId . '-' . $this->sapEncapValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---- Define Relationships ----
|
|
|
|
|
2021-03-31 17:28:47 +02:00
|
|
|
public function binds(): HasMany
|
2019-07-28 06:11:04 +02:00
|
|
|
{
|
2020-04-21 14:28:48 +02:00
|
|
|
return $this->hasMany(\App\Models\MplsSdpBind::class, 'svc_id');
|
2019-07-28 06:11:04 +02:00
|
|
|
}
|
2020-09-21 14:54:51 +02:00
|
|
|
|
2021-03-31 17:28:47 +02:00
|
|
|
public function services(): HasMany
|
2019-07-28 06:11:04 +02:00
|
|
|
{
|
2020-04-21 14:28:48 +02:00
|
|
|
return $this->hasMany(\App\Models\MplsService::class, 'svc_id');
|
2019-07-28 06:11:04 +02:00
|
|
|
}
|
|
|
|
}
|