Laravel 13 + Livewire/Volt app for managing client organizations, documents, passwords, flexible assets, virtual machines, contacts, domains, todos, shortcuts, and role-based user administration.
48 lines
1.0 KiB
PHP
48 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Contracts\Linkable;
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
#[Fillable([
|
|
'organization_id', 'name', 'role', 'memory_gb', 'cpu_count',
|
|
'operating_system', 'notes', 'created_by',
|
|
])]
|
|
class VirtualMachine extends Model implements Linkable
|
|
{
|
|
use SoftDeletes;
|
|
|
|
public function organization()
|
|
{
|
|
return $this->belongsTo(Organization::class);
|
|
}
|
|
|
|
public function creator()
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
|
|
public function logs()
|
|
{
|
|
return $this->hasMany(VirtualMachineLog::class)->orderByDesc('created_at');
|
|
}
|
|
|
|
public function linkableKind(): string
|
|
{
|
|
return 'VirtualMachine';
|
|
}
|
|
|
|
public function linkableLabel(): string
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
public function linkableUrl(): string
|
|
{
|
|
return route('organizations.virtual-machines.edit', [$this->organization_id, $this]);
|
|
}
|
|
}
|