Refactor DockerCleanupJob and Application model

This commit is contained in:
Andras Bacsai
2023-11-10 10:34:28 +01:00
parent ed34fc9645
commit 23a94c9378
2 changed files with 23 additions and 13 deletions

View File

@@ -213,6 +213,14 @@ class Application extends BaseModel
return $this->morphTo();
}
public function isDeploymentInprogress() {
$deployments = ApplicationDeploymentQueue::where('application_id', $this->id)->where('status', 'in_progress')->count();
if ($deployments > 0) {
return true;
}
return false;
}
public function deployments(int $skip = 0, int $take = 10)
{
$deployments = ApplicationDeploymentQueue::where('application_id', $this->id)->orderBy('created_at', 'desc');