name('home'); Route::middleware(['auth', 'verified'])->group(function () { Route::get('/dashboard', function () { $organisations = auth()->user()->organisations() ->withCount(['servers', 'applications', 'services']) ->get(); $organisationIds = $organisations->pluck('id'); return inertia('Dashboard', [ 'organisations' => $organisations, 'recentOperations' => Operation::query() ->with('target') ->whereHasMorph('target', [Service::class], fn ($query) => $query->whereIn('organisation_id', $organisationIds)) ->latest() ->limit(5) ->get(), 'unhealthyServices' => \App\Models\Service::query() ->whereIn('organisation_id', $organisationIds) ->whereNot('status', ServiceStatus::RUNNING) ->latest() ->limit(5) ->get(), ]); })->name('dashboard'); Route::prefix('organisations/{organisation}')->group(function () { Route::get('/', [OrganisationController::class, 'show'])->name('organisations.show'); Route::get('/onboarding', [OnboardingController::class, 'show'])->name('onboarding.show'); Route::get('/members', [OrganisationMemberController::class, 'index'])->name('organisation-members.index'); Route::post('/members', [OrganisationMemberController::class, 'store'])->name('organisation-members.store'); Route::put('/members/{member}', [OrganisationMemberController::class, 'update'])->name('organisation-members.update'); Route::delete('/members/{member}', [OrganisationMemberController::class, 'destroy'])->name('organisation-members.destroy'); Route::put('/invitations/{invitation}', [OrganisationMemberController::class, 'updateInvitation'])->name('organisation-invitations.update'); Route::delete('/invitations/{invitation}', [OrganisationMemberController::class, 'destroyInvitation'])->name('organisation-invitations.destroy'); Route::get('/environments', EnvironmentIndexController::class)->name('environments.index'); Route::get('/operations', [OperationController::class, 'index'])->name('operations.index'); Route::get('/operations/{operation}', [OperationController::class, 'show'])->name('operations.show'); Route::post('/operations/{operation}/retry', [OperationController::class, 'retry'])->name('operations.retry'); Route::post('/operations/{operation}/cancel', [OperationController::class, 'cancel'])->name('operations.cancel'); Route::get('/operations/{operation}/logs', [OperationController::class, 'downloadLogs'])->name('operations.logs'); Route::resource('providers', ProviderController::class) ->only('create', 'store', 'destroy') ->name('create', 'providers.create') ->name('store', 'providers.store') ->name('destroy', 'providers.destroy'); Route::resource('registries', RegistryController::class) ->only('index', 'create', 'store', 'show', 'edit', 'update', 'destroy') ->name('index', 'registries.index') ->name('create', 'registries.create') ->name('store', 'registries.store') ->name('show', 'registries.show') ->name('edit', 'registries.edit') ->name('update', 'registries.update') ->name('destroy', 'registries.destroy'); Route::resource('source-providers', SourceProviderController::class) ->only('index', 'create', 'store', 'edit', 'update', 'destroy') ->name('index', 'source-providers.index') ->name('create', 'source-providers.create') ->name('store', 'source-providers.store') ->name('edit', 'source-providers.edit') ->name('update', 'source-providers.update') ->name('destroy', 'source-providers.destroy'); Route::resource('servers', ServerController::class) ->only('index', 'show', 'create', 'store', 'destroy') ->name('index', 'servers.index') ->name('show', 'servers.show') ->name('create', 'servers.create') ->name('store', 'servers.store') ->name('destroy', 'servers.destroy'); Route::post('servers/{server}/heal', [ServerController::class, 'heal']) ->name('servers.heal'); Route::post('servers/{server}/firewall-rules', [ServerFirewallRuleController::class, 'store']) ->name('servers.firewall-rules.store'); Route::delete('servers/{server}/firewall-rules/{firewallRule}', [ServerFirewallRuleController::class, 'destroy']) ->name('servers.firewall-rules.destroy'); Route::prefix('servers/{server}')->group(function () { Route::resource('services', ServiceController::class) ->only('create', 'store', 'show', 'edit', 'update', 'destroy') ->name('create', 'services.create') ->name('store', 'services.store') ->name('show', 'services.show') ->name('edit', 'services.edit') ->name('update', 'services.update') ->name('destroy', 'services.destroy'); Route::get('services/{service}/updates/create', [ServiceUpdateController::class, 'create']) ->name('service-updates.create'); Route::post('services/{service}/updates/resolve', [ServiceUpdateController::class, 'resolve']) ->name('service-updates.resolve'); Route::post('services/{service}/updates', [ServiceUpdateController::class, 'store']) ->name('service-updates.store'); Route::get('services/{service}/replicas/{replica}', [ServiceReplicaController::class, 'show']) ->name('service-replicas.show'); Route::post('services/{service}/replicas/{replica}/start', [ServiceReplicaController::class, 'start']) ->name('service-replicas.start'); Route::post('services/{service}/replicas/{replica}/stop', [ServiceReplicaController::class, 'stop']) ->name('service-replicas.stop'); Route::post('services/{service}/replicas/{replica}/restart', [ServiceReplicaController::class, 'restart']) ->name('service-replicas.restart'); Route::get('services/{service}/slices', [ServiceSliceController::class, 'index']) ->name('service-slices.index'); Route::get('services/{service}/slices/create', [ServiceSliceController::class, 'create']) ->name('service-slices.create'); Route::post('services/{service}/slices', [ServiceSliceController::class, 'store']) ->name('service-slices.store'); Route::get('services/{service}/slices/{slice}', [ServiceSliceController::class, 'show']) ->name('service-slices.show'); }); Route::resource('applications', ApplicationController::class) ->only('show', 'index', 'create', 'store', 'edit', 'update', 'destroy') ->name('index', 'applications.index') ->name('show', 'applications.show') ->name('edit', 'applications.edit') ->name('update', 'applications.update') ->name('destroy', 'applications.destroy'); Route::get('applications/{application}/environments/create', [EnvironmentController::class, 'create']) ->name('environments.create'); Route::post('applications/{application}/environments', [EnvironmentController::class, 'store']) ->name('environments.store'); Route::get('applications/{application}/environments/{environment}', [EnvironmentController::class, 'show']) ->name('environments.show'); Route::get('applications/{application}/environments/{environment}/services/{service}', [ServiceController::class, 'showForEnvironment']) ->name('environment-services.show'); Route::get('applications/{application}/environments/{environment}/edit', [EnvironmentController::class, 'edit']) ->name('environments.edit'); Route::put('applications/{application}/environments/{environment}', [EnvironmentController::class, 'update']) ->name('environments.update'); Route::delete('applications/{application}/environments/{environment}', [EnvironmentController::class, 'destroy']) ->name('environments.destroy'); Route::get('applications/{application}/environments/{environment}/attachments/create', [EnvironmentAttachmentController::class, 'create']) ->name('environment-attachments.create'); Route::post('applications/{application}/environments/{environment}/attachments', [EnvironmentAttachmentController::class, 'store']) ->name('environment-attachments.store'); Route::get('applications/{application}/environments/{environment}/attachments/{attachment}/edit', [EnvironmentAttachmentController::class, 'edit']) ->name('environment-attachments.edit'); Route::put('applications/{application}/environments/{environment}/attachments/{attachment}', [EnvironmentAttachmentController::class, 'update']) ->name('environment-attachments.update'); Route::delete('applications/{application}/environments/{environment}/attachments/{attachment}', [EnvironmentAttachmentController::class, 'destroy']) ->name('environment-attachments.destroy'); Route::get('applications/{application}/environments/{environment}/gateway/routes', [GatewayRouteController::class, 'index']) ->name('gateway.routes.index'); Route::get('applications/{application}/environments/{environment}/gateway/routes/create', [GatewayRouteController::class, 'create']) ->name('gateway.routes.create'); Route::post('applications/{application}/environments/{environment}/gateway/routes', [GatewayRouteController::class, 'store']) ->name('gateway.routes.store'); Route::get('applications/{application}/environments/{environment}/gateway/routes/{route}/edit', [GatewayRouteController::class, 'edit']) ->name('gateway.routes.edit'); Route::put('applications/{application}/environments/{environment}/gateway/routes/{route}', [GatewayRouteController::class, 'update']) ->name('gateway.routes.update'); Route::delete('applications/{application}/environments/{environment}/gateway/routes/{route}', [GatewayRouteController::class, 'destroy']) ->name('gateway.routes.destroy'); Route::get('applications/{application}/environments/{environment}/build-artifacts', [BuildArtifactController::class, 'index']) ->name('build-artifacts.index'); Route::get('applications/{application}/environments/{environment}/build-artifacts/{artifact}', [BuildArtifactController::class, 'show']) ->name('build-artifacts.show'); Route::post('applications/{application}/environments/{environment}/workers', [EnvironmentWorkerController::class, 'store']) ->name('environment-workers.store'); Route::post('applications/{application}/environments/{environment}/migrations', [EnvironmentMigrationController::class, 'store']) ->name('environment-migrations.store'); Route::post('applications/{application}/environments/{environment}/deployments', [EnvironmentDeploymentController::class, 'store']) ->name('environment-deployments.store'); Route::get('applications/{application}/environments/{environment}/variables', [EnvironmentVariableController::class, 'index']) ->name('environment-variables.index'); Route::get('applications/{application}/environments/{environment}/variables/create', [EnvironmentVariableController::class, 'create']) ->name('environment-variables.create'); Route::post('applications/{application}/environments/{environment}/variables', [EnvironmentVariableController::class, 'store']) ->name('environment-variables.store'); Route::post('applications/{application}/environments/{environment}/variables/import', [EnvironmentVariableController::class, 'import']) ->name('environment-variables.import'); Route::get('applications/{application}/environments/{environment}/variables/{variable}/edit', [EnvironmentVariableController::class, 'edit']) ->name('environment-variables.edit'); Route::put('applications/{application}/environments/{environment}/variables/{variable}', [EnvironmentVariableController::class, 'update']) ->name('environment-variables.update'); Route::delete('applications/{application}/environments/{environment}/variables/{variable}', [EnvironmentVariableController::class, 'destroy']) ->name('environment-variables.destroy'); Route::post('applications/{application}/verify-repository', [ApplicationController::class, 'verifyRepository']) ->name('applications.verify-repository'); Route::post('applications/{application}/deploy-key/rotate', [ApplicationController::class, 'rotateDeployKey']) ->name('applications.deploy-key.rotate'); }); }); Route::get('/provision-script', ProvisionScript::class)->name('provision-script'); Route::post('/provision-callback', ProvisionCallback::class)->name('provision.callback'); require __DIR__.'/settings.php'; require __DIR__.'/auth.php';