lasthourcloud/app/Http/Controllers/ProjectController.php

47 lines
1.9 KiB
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers;
2023-04-12 08:14:57 +00:00
use Spatie\Activitylog\Models\Activity;
class ProjectController extends Controller
{
public function environments()
{
2023-04-12 20:13:17 +00:00
$project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
if (!$project) {
2023-04-25 12:43:35 +00:00
return redirect()->route('dashboard');
}
2023-04-12 20:13:17 +00:00
$project->load(['environments']);
2023-04-19 13:38:59 +00:00
if (count($project->environments) == 1) {
return redirect()->route('project.resources', ['project_uuid' => $project->uuid, 'environment_name' => $project->environments->first()->name]);
}
return view('project.environments', ['project' => $project]);
}
2023-03-31 11:32:07 +00:00
2023-04-26 11:25:41 +00:00
public function resources_new()
{
$project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
if (!$project) {
return redirect()->route('dashboard');
}
$environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first();
if (!$environment) {
return redirect()->route('dashboard');
}
return view('project.new', ['project' => $project, 'environment' => $environment, 'type' => 'resource']);
}
public function resources()
{
2023-03-30 17:50:27 +00:00
$project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
if (!$project) {
2023-04-25 12:43:35 +00:00
return redirect()->route('dashboard');
}
2023-03-30 17:50:27 +00:00
$environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first();
if (!$environment) {
2023-04-25 12:43:35 +00:00
return redirect()->route('dashboard');
2023-03-30 17:50:27 +00:00
}
2023-03-29 11:13:27 +00:00
return view('project.resources', ['project' => $project, 'environment' => $environment]);
}
}