This commit is contained in:
Andras Bacsai 2023-03-27 20:45:32 +02:00
parent 434ca04e00
commit 79f3b7c4b8
5 changed files with 11 additions and 30 deletions

View File

@ -1,19 +0,0 @@
<?php
namespace App\Http\Livewire;
use App\Models\Application;
use Livewire\Component;
class TemporaryCheckStatus extends Component
{
public $application_id;
public function checkStatus() {
dd(Application::find(1)->environment);
}
public function render()
{
return view('livewire.temporary-check-status');
}
}

View File

@ -6,7 +6,7 @@ class Database extends BaseModel
{ {
public function environment() public function environment()
{ {
return $this->morphTo(); return $this->belongsTo(Environment::class);
} }
public function destination() public function destination()
{ {

View File

@ -20,5 +20,10 @@ public function run(): void
'name' => 'production', 'name' => 'production',
'project_id' => $project_1->id, 'project_id' => $project_1->id,
]); ]);
Environment::create([
'id' => 2,
'name' => 'staging',
'project_id' => $project_1->id,
]);
} }
} }

View File

@ -2,26 +2,25 @@
<h1> <h1>
Coolify v4 🎉 Coolify v4 🎉
</h1> </h1>
<h2>Projects</h2> <h1>Projects</h1>
<ul> <ul>
@forelse ($projects as $project) @forelse ($projects as $project)
<li> <h2>{{ $project->name }}</h2>
<p>Project Name: {{ $project->name }}</p>
<p>Project Settings:{{ $project->settings }}</p> <p>Project Settings:{{ $project->settings }}</p>
<h2>Environments</h2> <h2>Environments</h2>
@forelse ($project->environments as $environment) @forelse ($project->environments as $environment)
<p>Environment Name: {{ $environment->name }}</p> <p>Environment Name: {{ $environment->name }}</p>
<h2>Applications</h2> <h2>Applications</h2>
@forelse ($environment->applications as $application) @forelse ($environment->applications as $application)
<p>Application: {{ $application->name }}</p> <h3>{{ $application->name }}</h3>
<p>Destination: {{ $application->destination }}</p> <p>Application: {{ $application }}</p>
<p>Destination Class: {{ $application->destination->getMorphClass() }}</p> <p>Destination Class: {{ $application->destination->getMorphClass() }}</p>
<livewire:temporary-check-status :application_id="$application->id" />
@empty @empty
<li>No application found</li> <li>No application found</li>
@endforelse @endforelse
<h2>Databases</h2> <h2>Databases</h2>
@forelse ($environment->databases as $database) @forelse ($environment->databases as $database)
<h3>{{ $database->name }}</h3>
<p>Database: {{ $database }}</p> <p>Database: {{ $database }}</p>
@empty @empty
<li>No database found</li> <li>No database found</li>
@ -29,7 +28,6 @@
@empty @empty
<p>No environments found</p> <p>No environments found</p>
@endforelse @endforelse
</li>
@empty @empty
<li>No projects found</li> <li>No projects found</li>
@endforelse @endforelse

View File

@ -1,3 +0,0 @@
<div>
<button wire:click='checkStatus'>Check Status</button>
</div>