Rewrite ipv4 address discovery to Eloquent (#15830)

* rewrite ipv4 discovery to Eloquent

* style ci
This commit is contained in:
Peca Nesovanovic
2024-02-21 19:10:00 +01:00
committed by GitHub
parent b8095d6811
commit bfdc2c472f
4 changed files with 123 additions and 68 deletions

View File

@@ -33,4 +33,11 @@ class Ipv4Address extends PortRelatedModel
public $timestamps = false;
protected $primaryKey = 'ipv4_address_id';
protected $fillable = [
'ipv4_address',
'ipv4_prefixlen',
'ipv4_network_id',
'port_id',
'context_name',
];
}

View File

@@ -35,11 +35,14 @@ class Ipv4Network extends Model
public $timestamps = false;
protected $primaryKey = 'ipv4_network_id';
protected $fillable = [
'ipv4_network',
'context_name',
];
// ---- Define Relationships ----
public function ipv4(): HasMany
{
return $this->hasMany(\App\Models\Ipv4Address::class, 'ipv4_network_id');
return $this->hasMany(Ipv4Address::class, 'ipv4_network_id');
}
}