lasthourcloud/routes/web.php

102 lines
3.3 KiB
PHP
Raw Normal View History

2023-03-17 14:33:48 +00:00
<?php
2023-04-19 10:42:15 +00:00
use App\Http\Controllers\ApplicationController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\ProjectController;
2023-04-25 07:38:05 +00:00
use App\Models\InstanceSettings;
2023-03-17 14:33:48 +00:00
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
2023-03-20 12:04:22 +00:00
Route::middleware(['auth'])->group(function () {
2023-04-25 07:38:05 +00:00
Route::get('/', function () {
$projects = session('currentTeam')->load(['projects'])->projects;
$servers = session('currentTeam')->load(['servers'])->servers;
2023-04-25 09:01:56 +00:00
return view('dashboard', [
2023-04-25 08:47:13 +00:00
'servers' => $servers->sortBy('name'),
'projects' => $projects->sortBy('name')
2023-04-25 07:38:05 +00:00
]);
2023-04-25 09:01:56 +00:00
})->name('dashboard');
Route::get('/profile', function () {
return view('profile');
2023-04-25 07:38:05 +00:00
})->name('profile');
Route::get('/settings', function () {
$isRoot = auth()->user()->isRoot();
if ($isRoot) {
$settings = InstanceSettings::find(0);
return view('settings', [
'settings' => $settings
]);
} else {
2023-04-25 12:43:35 +00:00
return redirect()->route('dashboard');
2023-04-25 07:38:05 +00:00
}
})->name('settings');
2023-04-14 08:00:42 +00:00
Route::get('/update', function () {
return view('update');
2023-04-25 07:38:05 +00:00
})->name('update');
Route::get('/demo', function () {
return view('demo');
2023-04-25 07:38:05 +00:00
})->name('demo');
});
2023-04-25 08:47:13 +00:00
Route::middleware(['auth'])->group(function () {
Route::get('/server/new', fn () => view('server.new'))->name('server.new');
2023-04-25 08:47:13 +00:00
Route::get('/server/{server_uuid}', function () {
$server = session('currentTeam')->load(['servers'])->servers->firstWhere('uuid', request()->server_uuid);
if (!$server) {
abort(404);
}
return view('server.show', [
2023-04-25 08:47:13 +00:00
'server_id' => $server->id,
]);
})->name('server.show');
2023-04-25 08:47:13 +00:00
});
2023-04-25 07:38:05 +00:00
Route::middleware(['auth'])->group(function () {
2023-04-26 11:25:41 +00:00
Route::get('/project/new', fn () => view('project.new', ['type' => 'project']))->name('project.new');
2023-04-25 07:38:05 +00:00
Route::get(
'/project/{project_uuid}',
[ProjectController::class, 'environments']
)->name('project.environments');
2023-04-26 11:25:41 +00:00
Route::get(
'/project/{project_uuid}/{environment_name}/new',
[ProjectController::class, 'resources_new']
)->name('project.resources.new');
2023-04-25 07:38:05 +00:00
Route::get(
'/project/{project_uuid}/{environment_name}',
[ProjectController::class, 'resources']
)->name('project.resources');
Route::get(
'/project/{project_uuid}/{environment_name}/application/{application_uuid}',
[ApplicationController::class, 'configuration']
2023-04-25 09:01:56 +00:00
)->name('project.application.configuration');
2023-04-25 07:38:05 +00:00
Route::get(
'/project/{project_uuid}/{environment_name}/application/{application_uuid}/deployment',
[ApplicationController::class, 'deployments']
2023-04-25 09:01:56 +00:00
)->name('project.application.deployments');
2023-04-25 07:38:05 +00:00
Route::get(
'/project/{project_uuid}/{environment_name}/application/{application_uuid}/deployment/{deployment_uuid}',
[ApplicationController::class, 'deployment']
2023-04-25 09:01:56 +00:00
)->name('project.application.deployment');
});