You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
virt/web/app/Models/CloudPublicIp.php

33 lines
860 B
PHTML

<?php
namespace App\Models;
final class CloudPublicIp extends Model
{
protected $connection = 'default';
protected $table = 'cloud_public_ips';
protected $casts = [
'id' => 'int',
'host_id' => 'int',
'public_ip_pool_id' => 'int',
'prefix_length' => 'int',
'reservation_id' => 'int',
'instance_id' => 'int',
'created_at' => 'int',
'updated_at' => 'int',
];
/** New ledger rows must always belong to one validated public pool. */
protected static function booted(): void
{
static::creating(static function (self $row): void {
if ((int) ($row->public_ip_pool_id ?? 0) < 1) {
throw new \LogicException(
'New public IP rows require a public pool association.'
);
}
});
}
}