2026-01-26 23:56:46 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2026-01-27 16:32:55 +00:00
|
|
|
namespace Core\Mod\Uptelligence\Models;
|
2026-01-26 23:56:46 +00:00
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Asset Version - tracks version history for assets.
|
|
|
|
|
*
|
|
|
|
|
* Stores changelog, breaking changes, and download information.
|
|
|
|
|
*/
|
|
|
|
|
class AssetVersion extends Model
|
|
|
|
|
{
|
|
|
|
|
use HasFactory;
|
|
|
|
|
|
2026-01-29 13:29:26 +00:00
|
|
|
/**
|
|
|
|
|
* The table associated with the model.
|
|
|
|
|
*/
|
|
|
|
|
protected $table = 'uptelligence_asset_versions';
|
|
|
|
|
|
2026-01-26 23:56:46 +00:00
|
|
|
protected $fillable = [
|
|
|
|
|
'asset_id',
|
|
|
|
|
'version',
|
|
|
|
|
'changelog',
|
|
|
|
|
'breaking_changes',
|
|
|
|
|
'download_url',
|
|
|
|
|
'local_path',
|
|
|
|
|
'released_at',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
protected $casts = [
|
|
|
|
|
'breaking_changes' => 'array',
|
|
|
|
|
'released_at' => 'datetime',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
public function asset(): BelongsTo
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Asset::class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function hasBreakingChanges(): bool
|
|
|
|
|
{
|
|
|
|
|
return ! empty($this->breaking_changes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function isStored(): bool
|
|
|
|
|
{
|
|
|
|
|
return $this->local_path && file_exists($this->local_path);
|
|
|
|
|
}
|
|
|
|
|
}
|