organization = $organization; if ($virtualMachine?->exists) { $this->virtualMachine = $virtualMachine; $this->name = $virtualMachine->name; $this->role = $virtualMachine->role ?? ''; $this->memory_gb = $virtualMachine->memory_gb; $this->cpu_count = $virtualMachine->cpu_count; $this->operating_system = $virtualMachine->operating_system ?? ''; $this->notes = $virtualMachine->notes ?? ''; } } public function save(): void { $validated = $this->validate([ 'name' => 'required|string|max:255', 'role' => 'nullable|string|max:255', 'memory_gb' => 'nullable|integer|min:0', 'cpu_count' => 'nullable|integer|min:0', 'operating_system' => 'nullable|string|max:255', 'notes' => 'nullable|string', ]); if ($this->virtualMachine?->exists) { $this->virtualMachine->update($validated); session()->flash('status', "Machine virtuelle \"{$this->virtualMachine->name}\" mise à jour."); } else { $this->organization->virtualMachines()->create([ ...$validated, 'created_by' => auth()->id(), ]); session()->flash('status', "Machine virtuelle \"{$this->name}\" créée."); } $this->redirectRoute('organizations.virtual-machines.index', $this->organization, navigate: true); } public function addLogEntry(): void { $this->validate(['newLogNote' => 'required|string']); $this->virtualMachine->logs()->create([ 'note' => $this->newLogNote, 'created_by' => auth()->id(), ]); $this->newLogNote = ''; } }; ?>

{{ $organization->name }}

{{ $virtualMachine?->exists ? 'Modifier la machine virtuelle' : 'Nouvelle machine virtuelle' }}

@error('name')

{{ $message }}

@enderror
@error('memory_gb')

{{ $message }}

@enderror
@error('cpu_count')

{{ $message }}

@enderror
Annuler
@if ($virtualMachine?->exists)

Journal MCO

@error('newLogNote')

{{ $message }}

@enderror
@forelse ($virtualMachine->logs as $log) @empty @endforelse
Note Par Quand
{{ $log->note }} {{ $log->creator?->name ?? 'système' }} {{ $log->created_at->diffForHumans() }}
Aucune entrée pour le moment.
@endif