2020-04-16 09:19:58 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2022-01-30 16:28:18 -06:00
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
use LibreNMS\Interfaces\Models\Keyable;
|
|
|
|
|
|
|
|
class PortStp extends PortRelatedModel implements Keyable
|
2020-04-16 09:19:58 -05:00
|
|
|
{
|
|
|
|
protected $table = 'ports_stp';
|
|
|
|
protected $primaryKey = 'port_stp_id';
|
|
|
|
public $timestamps = false;
|
2022-01-30 16:28:18 -06:00
|
|
|
protected $fillable = [
|
|
|
|
'device_id',
|
|
|
|
'vlan',
|
|
|
|
'port_id',
|
|
|
|
'port_index',
|
|
|
|
'priority',
|
|
|
|
'state',
|
|
|
|
'enable',
|
|
|
|
'pathCost',
|
|
|
|
'designatedRoot',
|
|
|
|
'designatedCost',
|
|
|
|
'designatedBridge',
|
|
|
|
'designatedPort',
|
|
|
|
'forwardTransitions',
|
|
|
|
];
|
|
|
|
|
|
|
|
public function getCompositeKey()
|
|
|
|
{
|
|
|
|
return "$this->vlan-$this->port_index";
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---- Define Relationships ----
|
|
|
|
|
|
|
|
public function device(): BelongsTo
|
|
|
|
{
|
|
|
|
return $this->belongsTo(\App\Models\Device::class, 'device_id', 'device_id');
|
|
|
|
}
|
2020-04-16 09:19:58 -05:00
|
|
|
}
|