vmwVmState); } public function getMemoryFormattedAttribute(): string { return Number::formatBi($this->vmwVmMemSize * 1024 * 1024); } public function getOperatingSystemAttribute(): string { if (Str::contains($this->vmwVmGuestOS, 'tools not installed')) { return 'Unknown (VMware Tools not installed)'; } elseif (Str::contains($this->vmwVmGuestOS, 'tools not running')) { return 'Unknown (VMware Tools not running)'; } elseif (empty($this->vmwVmGuestOS)) { return '(Unknown)'; } else { return Rewrite::vmwareGuest($this->vmwVmGuestOS); } } public function scopeGuessFromDevice(Builder $query, Device $device): Builder { $where = [$device->hostname]; if (Config::get('mydomain')) { $where[] = $device->hostname . '.' . Config::get('mydomain'); } return $query->whereIn('vmwVmDisplayName', $where); } public function parentDevice(): HasOne { return $this->hasOne(\App\Models\Device::class, 'hostname', 'vmwVmDisplayName'); } public function getCompositeKey() { return $this->vm_type . $this->vmwVmVMID; } }