*/ 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 */ 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); } }