wip
This commit is contained in:
parent
8019dc1267
commit
19ec042a0a
@ -6,7 +6,7 @@ class HomeController extends Controller
|
||||
{
|
||||
public function show()
|
||||
{
|
||||
$projects = session('currentTeam')->projects;
|
||||
$projects = session('currentTeam')->load(['projects'])->projects;
|
||||
return view('home', ['projects' => $projects]);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ class ProjectController extends Controller
|
||||
{
|
||||
public function environments()
|
||||
{
|
||||
$project = session('currentTeam')->projects->where('uuid', request()->route('project_uuid'))->first();
|
||||
$project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first()->load(['environments']);
|
||||
if (!$project) {
|
||||
return redirect()->route('home');
|
||||
}
|
||||
@ -19,17 +19,27 @@ public function environments()
|
||||
}
|
||||
public function resources()
|
||||
{
|
||||
$project = session('currentTeam')->projects->where('uuid', request()->route('project_uuid'))->first();
|
||||
$project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
|
||||
if (!$project) {
|
||||
return redirect()->route('home');
|
||||
}
|
||||
$environment = Environment::where('name', request()->route('environment_name'))->where('project_id', $project->id)->first();
|
||||
// $environment = $project->environments->where('name', request()->route('environment_name'))->first();
|
||||
$environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first();
|
||||
if (!$environment) {
|
||||
return redirect()->route('home');
|
||||
}
|
||||
return view('project.resources', ['project' => $project, 'environment' => $environment]);
|
||||
}
|
||||
public function application()
|
||||
{
|
||||
$application = Application::where('uuid', request()->route('application_uuid'))->first();
|
||||
$project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
|
||||
if (!$project) {
|
||||
return redirect()->route('home');
|
||||
}
|
||||
$environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first()->load(['applications']);
|
||||
if (!$environment) {
|
||||
return redirect()->route('home');
|
||||
}
|
||||
$application = $environment->applications->where('uuid', request()->route('application_uuid'))->first();
|
||||
if (!$application) {
|
||||
return redirect()->route('home');
|
||||
}
|
||||
@ -38,7 +48,6 @@ public function application()
|
||||
|
||||
public function deployment()
|
||||
{
|
||||
$application_uuid = request()->route('application_uuid');
|
||||
$deployment_uuid = request()->route('deployment_uuid');
|
||||
|
||||
$application = Application::where('uuid', request()->route('application_uuid'))->first();
|
||||
|
@ -19,4 +19,7 @@ public function environments() {
|
||||
public function settings() {
|
||||
return $this->hasOne(ProjectSetting::class);
|
||||
}
|
||||
public function applications() {
|
||||
return $this->hasManyThrough(Application::class, Environment::class);
|
||||
}
|
||||
}
|
||||
|
@ -16,4 +16,7 @@ public function projects() {
|
||||
public function servers() {
|
||||
return $this->hasMany(Server::class);
|
||||
}
|
||||
public function applications() {
|
||||
return $this->hasManyThrough(Application::class, Project::class);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
<x-layout>
|
||||
<h1>Environments</h1>
|
||||
|
||||
@foreach ($project->environments as $environment)
|
||||
<div>
|
||||
<a href="{{ route('project.resources', [$project->uuid, $environment->name]) }}">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<div>
|
||||
@foreach ($environment->applications as $application)
|
||||
<p>
|
||||
<a href="{{ route('project.application', [$application->uuid]) }}">
|
||||
<a href="{{ route('project.application', [$project->uuid, $environment->name, $application->uuid]) }}">
|
||||
{{ $application->name }}
|
||||
</a>
|
||||
</p>
|
||||
|
@ -23,8 +23,8 @@
|
||||
|
||||
Route::get('/project/{project_uuid}/{environment_name}', [ProjectController::class, 'resources'])->name('project.resources');
|
||||
|
||||
Route::get('/application/{application_uuid}', [ProjectController::class, 'application'])->name('project.application');
|
||||
Route::get('/application/{application_uuid}/deployment/{deployment_uuid}', [ProjectController::class, 'deployment'])->name('project.deployment');
|
||||
Route::get('/project/{project_uuid}/{environment_name}/application/{application_uuid}', [ProjectController::class, 'application'])->name('project.application');
|
||||
// Route::get('/project/{project_uuid}/{environment_name}/application/{application_uuid}/deployment/{deployment_uuid}', [ProjectController::class, 'deployment'])->name('project.deployment');
|
||||
|
||||
// Route::get('/database/{database_uuid}', [ProjectController::class, 'database'])->name('project.database');
|
||||
// Route::get('//service/{service_uuid}', [ProjectController::class, 'service'])->name('project.service');
|
||||
|
Loading…
Reference in New Issue
Block a user