refactor: Update Project/Show component to sort environments by created_at
This commit is contained in:
parent
2421f7c35c
commit
93c890ce41
@ -9,6 +9,8 @@ class Show extends Component
|
|||||||
{
|
{
|
||||||
public Project $project;
|
public Project $project;
|
||||||
|
|
||||||
|
public $environments;
|
||||||
|
|
||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
$projectUuid = request()->route('project_uuid');
|
$projectUuid = request()->route('project_uuid');
|
||||||
@ -18,7 +20,8 @@ public function mount()
|
|||||||
if (! $project) {
|
if (! $project) {
|
||||||
return redirect()->route('dashboard');
|
return redirect()->route('dashboard');
|
||||||
}
|
}
|
||||||
$project->load(['environments']);
|
|
||||||
|
$this->environments = $project->environments->sortBy('created_at');
|
||||||
$this->project = $project;
|
$this->project = $project;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="text-xs truncate subtitle lg:text-sm">{{ $project->name }}.</div>
|
<div class="text-xs truncate subtitle lg:text-sm">{{ $project->name }}.</div>
|
||||||
<div class="grid gap-2 lg:grid-cols-2">
|
<div class="grid gap-2 lg:grid-cols-2">
|
||||||
@forelse ($project->environments as $environment)
|
@forelse ($environments as $environment)
|
||||||
<div class="gap-2 border border-transparent cursor-pointer box group" x-data
|
<div class="gap-2 border border-transparent cursor-pointer box group" x-data
|
||||||
x-on:click="goto('{{ $project->uuid }}','{{ $environment->name }}')">
|
x-on:click="goto('{{ $project->uuid }}','{{ $environment->name }}')">
|
||||||
<div class="flex flex-1 mx-6">
|
<div class="flex flex-1 mx-6">
|
||||||
|
Loading…
Reference in New Issue
Block a user