initial commit

This commit is contained in:
TheOnlyMace
2026-05-17 13:26:14 +02:00
commit 75299b723d
176 changed files with 20327 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
<?php
namespace App\Http\Controllers\Web;
use App\Http\Controllers\Controller;
use App\Models\Customer;
use App\Models\VmSnapshot;
use App\Services\Hosting\Snapshots\SnapshotService;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
class VmSnapshotController extends Controller
{
public function store(Request $request, Customer $vm, SnapshotService $snapshots): RedirectResponse
{
$this->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.');
}
}