belongsTo(\App\Models\OsGroup::class); } public function host() { return $this->belongsTo(\App\Models\ModuleHost::class, 'module_host_id'); } public function datastore() { return $this->belongsTo(\App\Models\ModuleDatastore::class, 'datastore_id'); } public function network() { return $this->belongsTo(\App\Models\ModuleNetwork::class, 'module_network_id'); } public function resourcePool() { return $this->belongsTo(\App\Models\ModuleResourcePool::class, 'resource_pool_id'); } public function folder() { return $this->belongsTo(\App\Models\ModuleFolder::class, 'folder_id'); } /** * Many-to-many relationship với Products (new table: os_product) */ public function products() { return $this->belongsToMany(\App\Models\Product::class, 'os_product', 'os_id', 'product_id') ->withTimestamps(); } /** * Get display name with OS Group */ public function getNameAttribute() { if ($this->osGroup) { return $this->osGroup->name . ' ' . $this->version; } return $this->version; } }