build logs
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (8.3) (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled

This commit is contained in:
2026-04-24 14:59:20 +03:00
parent 579d1ad214
commit 9fbec77ac7
15 changed files with 1804 additions and 2 deletions

View File

@@ -0,0 +1,80 @@
<?php
namespace App\Models;
use Database\Factories\DockerImageBuildFactory;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
#[Fillable([
'user_id',
'image_name',
'image_tag',
'dockerfile_content',
'environment',
'status',
'build_output',
'successful',
'exit_code',
'queued_at',
'started_at',
'finished_at',
])]
class DockerImageBuild extends Model
{
/** @use HasFactory<DockerImageBuildFactory> */
use HasFactory;
public const STATUS_QUEUED = 'queued';
public const STATUS_RUNNING = 'running';
public const STATUS_SUCCEEDED = 'succeeded';
public const STATUS_FAILED = 'failed';
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'environment' => 'array',
'successful' => 'boolean',
'queued_at' => 'datetime',
'started_at' => 'datetime',
'finished_at' => 'datetime',
];
}
/**
* Get the user that owns the Docker image build.
*/
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
/**
* Get the full Docker image reference.
*/
public function image(): string
{
return "{$this->image_name}:{$this->image_tag}";
}
/**
* Determine if the build has finished running.
*/
public function isFinished(): bool
{
return in_array($this->status, [
self::STATUS_SUCCEEDED,
self::STATUS_FAILED,
], true);
}
}