44 lines
2.0 KiB
PHP
44 lines
2.0 KiB
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Route;
|
|
use Livewire\Volt\Volt;
|
|
|
|
Route::view('/', 'welcome');
|
|
|
|
/* ─────────────────────────────────────────────────────────
|
|
* Workspace-scoped routes (everything authenticated)
|
|
* URL shape: /w/{wsId}/dashboard, /w/{wsId}/sites, …
|
|
* ───────────────────────────────────────────────────────── */
|
|
Route::middleware(['auth', 'verified'])
|
|
->prefix('w/{wsId}')
|
|
->group(function () {
|
|
Volt::route('dashboard', 'pages.dashboard')->name('dashboard');
|
|
Volt::route('sites', 'pages.sites.index')->name('sites.index');
|
|
Volt::route('sites/{site}', 'pages.sites.show')->name('sites.show');
|
|
Volt::route('servers', 'pages.servers.index')->name('servers.index');
|
|
Volt::route('clusters/new', 'pages.clusters.create')->name('clusters.create');
|
|
Volt::route('backups', 'pages.backups.index')->name('backups.index');
|
|
Volt::route('security', 'pages.security.index')->name('security.index');
|
|
Volt::route('team', 'pages.team.index')->name('team.index');
|
|
Volt::route('settings', 'pages.settings.index')->name('settings.index');
|
|
});
|
|
|
|
/* Profile (no workspace prefix — user-scoped). */
|
|
Route::view('profile', 'profile')
|
|
->middleware(['auth'])
|
|
->name('profile');
|
|
|
|
/* Redirect bare /dashboard etc. to current workspace's URL. */
|
|
Route::middleware(['auth'])->group(function () {
|
|
foreach (['dashboard', 'sites', 'servers', 'backups', 'security', 'team', 'settings'] as $shortcut) {
|
|
Route::get($shortcut, function () use ($shortcut) {
|
|
$ws = auth()->user()?->currentWorkspace;
|
|
return $ws
|
|
? redirect("/w/{$ws->public_id}/{$shortcut}")
|
|
: redirect('/');
|
|
});
|
|
}
|
|
});
|
|
|
|
require __DIR__ . '/auth.php';
|