Enhance VM service management: add service_id and plain_password fields, sync service records, and update related migrations

This commit is contained in:
pbao9
2026-04-16 09:39:52 +07:00
parent bb73d6c5a2
commit d68fda2cf0
11 changed files with 206 additions and 104 deletions
+11 -1
View File
@@ -27,7 +27,11 @@ class ModuleVmware extends Model
'vcenter_id',
'os_id',
'customer_id',
'status'
'status',
'service_id',
'ip',
'dns',
'plain_password',
];
// NOTE: password must NOT use 'hashed' cast — it is a VM guest credential
@@ -63,6 +67,12 @@ class ModuleVmware extends Model
return $this->hasMany(\App\Models\Service::class, 'vm_id', 'vmware_id');
}
/** Direct link via service_id FK (new). */
public function service()
{
return $this->belongsTo(\App\Models\Service::class, 'service_id');
}
public function getStatus()
{
return match ($this->status) {