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.

refactor(deployment): enhance deployment data retrieval and relationships

Andras Bacsai4b947a0d6415
diff --git a/app/Livewire/DeploymentsIndicator.php b/app/Livewire/DeploymentsIndicator.php
index 0293ad6c6c..ac9cfd1c2d 100644
--- a/app/Livewire/DeploymentsIndicator.php
+++ b/app/Livewire/DeploymentsIndicator.php
@@ -16,7 +16,8 @@ class DeploymentsIndicator extends Component
{
$servers = Server::ownedByCurrentTeam()->get();
- return ApplicationDeploymentQueue::whereIn('status', ['in_progress', 'queued'])
+ return ApplicationDeploymentQueue::with(['application.environment.project'])
+ ->whereIn('status', ['in_progress', 'queued'])
->whereIn('server_id', $servers->pluck('id'))
->orderBy('id')
->get([
diff --git a/app/Models/ApplicationDeploymentQueue.php b/app/Models/ApplicationDeploymentQueue.php
index 8df6877ab6..4e8eee10fc 100644
--- a/app/Models/ApplicationDeploymentQueue.php
+++ b/app/Models/ApplicationDeploymentQueue.php
@@ -41,11 +41,9 @@ class ApplicationDeploymentQueue extends Model
{
protected $guarded = [];
- public function application(): Attribute
+ public function application()
{
- return Attribute::make(
- get: fn () => Application::find($this->application_id),
- );
+ return $this->belongsTo(Application::class);
}
public function server(): Attribute
diff --git a/resources/views/livewire/deployments-indicator.blade.php b/resources/views/livewire/deployments-indicator.blade.php
index ed24249e0c..7f3cc23ed1 100644
--- a/resources/views/livewire/deployments-indicator.blade.php
+++ b/resources/views/livewire/deployments-indicator.blade.php
@@ -68,6 +68,9 @@
{{ $deployment->application_name }}
</div>
<p class="text-xs dark:text-neutral-400 text-gray-600 mt-1">
+ {{ $deployment->application?->environment?->project?->name }} / {{ $deployment->application?->environment?->name }}
+ </p>
+ <p class="text-xs dark:text-neutral-400 text-gray-600">
{{ $deployment->server_name }}
</p>
@if ($deployment->pull_request_id)