authorize('manage', $vm); $request->validate(['label' => ['nullable', 'string', 'max:64']]); try { $snapshots->create($vm, $request->user(), false, $request->input('label')); } catch (\Throwable $e) { return back()->withErrors(['snapshot' => $e->getMessage()]); } return back()->with('success', 'Snapshot erstellt.'); } public function rollback(Customer $vm, VmSnapshot $snapshot, SnapshotService $snapshots): RedirectResponse { $this->authorize('manage', $vm); abort_unless($snapshot->customer_id === $vm->id, 404); try { $snapshots->rollback($vm, $snapshot); } catch (\Throwable $e) { return back()->withErrors(['snapshot' => $e->getMessage()]); } return back()->with('success', 'Snapshot wiederhergestellt.'); } public function destroy(Customer $vm, VmSnapshot $snapshot, SnapshotService $snapshots): RedirectResponse { $this->authorize('manage', $vm); abort_unless($snapshot->customer_id === $vm->id, 404); try { $snapshots->delete($vm, $snapshot); } catch (\Throwable $e) { return back()->withErrors(['snapshot' => $e->getMessage()]); } return back()->with('success', 'Snapshot gelöscht.'); } }