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()
{
return $this->morphTo();
return $this->belongsTo(Environment::class);
}
public function destination()
{

View File

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

View File

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

View File

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