mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
38 lines
918 B
PHP
38 lines
918 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
|
|
class Link extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
public $timestamps = false;
|
|
|
|
// ---- Define Relationships ----
|
|
|
|
public function device(): BelongsTo
|
|
{
|
|
return $this->belongsTo(\App\Models\Device::class, 'local_device_id', 'device_id');
|
|
}
|
|
|
|
public function port(): BelongsTo
|
|
{
|
|
return $this->belongsTo(\App\Models\Port::class, 'local_port_id', 'port_id');
|
|
}
|
|
|
|
public function remoteDevice(): HasOne
|
|
{
|
|
return $this->hasOne(\App\Models\Device::class, 'device_id', 'remote_device_id');
|
|
}
|
|
|
|
public function remotePort(): HasOne
|
|
{
|
|
return $this->hasOne(\App\Models\Port::class, 'port_id', 'remote_port_id');
|
|
}
|
|
}
|