Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

navigate to environment via uuid

peaklabs-dev4c21807b7a1d
diff --git a/app/Livewire/Project/Show.php b/app/Livewire/Project/Show.php
index 2335519c74..886a20218f 100644
--- a/app/Livewire/Project/Show.php
+++ b/app/Livewire/Project/Show.php
@@ -6,6 +6,7 @@ use App\Models\Environment;
use App\Models\Project;
use Livewire\Attributes\Validate;
use Livewire\Component;
+use Visus\Cuid2\Cuid2;
class Show extends Component
{
@@ -33,17 +34,26 @@ class Show extends Component
$environment = Environment::create([
'name' => $this->name,
'project_id' => $this->project->id,
+ 'uuid' => (string) new Cuid2,
]);
return redirect()->route('project.resource.index', [
'project_uuid' => $this->project->uuid,
- 'environment_name' => $environment->name,
+ 'environment_uuid' => $environment->uuid,
]);
} catch (\Throwable $e) {
handleError($e, $this);
}
}
+ public function navigateToEnvironment($projectUuid, $environmentUuid)
+ {
+ return redirect()->route('project.resource.index', [
+ 'project_uuid' => $projectUuid,
+ 'environment_uuid' => $environmentUuid,
+ ]);
+ }
+
public function render()
{
return view('livewire.project.show');
diff --git a/resources/views/livewire/project/show.blade.php b/resources/views/livewire/project/show.blade.php
index 8615377332..6528f3ee89 100644
--- a/resources/views/livewire/project/show.blade.php
+++ b/resources/views/livewire/project/show.blade.php
@@ -17,18 +17,18 @@
<div class="text-xs truncate subtitle lg:text-sm">{{ $project->name }}.</div>
<div class="grid gap-2 lg:grid-cols-2">
@forelse ($project->environments->sortBy('created_at') as $environment)
- <div class="gap-2 border border-transparent cursor-pointer box group" x-data
- x-on:click="goto('{{ $project->uuid }}','{{ $environment->name }}')">
+ <div class="gap-2 border border-transparent cursor-pointer box group"
+ wire:click="navigateToEnvironment('{{ $project->uuid }}', '{{ $environment->uuid }}')">
<div class="flex flex-1 mx-6">
<a class="flex flex-col justify-center flex-1"
- href="{{ route('project.resource.index', [$project->uuid, $environment->name]) }}">
+ href="{{ route('project.resource.index', ['project_uuid' => $project->uuid, 'environment_uuid' => $environment->uuid]) }}">
<div class="font-bold dark:text-white"> {{ $environment->name }}</div>
<div class="description">
{{ $environment->description }}</div>
</a>
<div class="flex items-center justify-center gap-2 text-xs">
<a class="font-bold hover:underline"
- href="{{ route('project.environment.edit', ['project_uuid' => data_get($project, 'uuid'), 'environment_name' => $environment->name]) }}">
+ href="{{ route('project.environment.edit', ['project_uuid' => $project->uuid, 'environment_uuid' => $environment->uuid]) }}">
Settings
</a>
</div>
@@ -37,10 +37,5 @@
@empty
<p>No environments found.</p>
@endforelse
- <script>
- function goto(projectUuid, environmentName) {
- window.location.href = '/project/' + projectUuid + '/' + environmentName;
- }
- </script>
</div>
</div>