48 lines
962 B
PHP
48 lines
962 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class TopologyLink extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'path_geojson' => 'array',
|
|
'metadata' => 'array',
|
|
'installed_at' => 'date',
|
|
];
|
|
}
|
|
|
|
public function tenant()
|
|
{
|
|
return $this->belongsTo(Tenant::class);
|
|
}
|
|
|
|
public function sourceNode()
|
|
{
|
|
return $this->belongsTo(TopologyNode::class, 'source_node_id');
|
|
}
|
|
|
|
public function targetNode()
|
|
{
|
|
return $this->belongsTo(TopologyNode::class, 'target_node_id');
|
|
}
|
|
|
|
public function sourcePort()
|
|
{
|
|
return $this->belongsTo(TopologyPort::class, 'source_port_id');
|
|
}
|
|
|
|
public function targetPort()
|
|
{
|
|
return $this->belongsTo(TopologyPort::class, 'target_port_id');
|
|
}
|
|
}
|