Deploy HickLab3D Dashboard / Deploy to production (push) Failing after 23s
Replace the old touchmark/PNG identity with the supplied lockup and monogram, segmented role-aware navigation, Live/Draft listing filters with generation-based cache invalidation, and admin Projects covering immutable file revisions, listing live pointers, and exact-decimal filament/packaging/shipping costing. Additive schema only; no Etsy publication. Isolated clone tests: 301 tests, 1162 assertions.
64 lines
1.5 KiB
PHP
64 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Database\Factories\ProjectRevisionFactory;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class ProjectRevision extends Model
|
|
{
|
|
/** @use HasFactory<ProjectRevisionFactory> */
|
|
use HasFactory;
|
|
|
|
public const STATUS_DRAFT = 'draft';
|
|
|
|
public const STATUS_APPROVED = 'approved';
|
|
|
|
public const STATUS_SUPERSEDED = 'superseded';
|
|
|
|
protected $fillable = [
|
|
'project_id', 'revision_number', 'change_notes', 'status', 'created_by',
|
|
'approved_by', 'approved_at', 'fusion_project_id', 'fusion_document_id', 'fusion_version',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'approved_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function project(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Project::class);
|
|
}
|
|
|
|
public function creator(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
|
|
public function approver(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'approved_by');
|
|
}
|
|
|
|
public function files(): HasMany
|
|
{
|
|
return $this->hasMany(ProjectFile::class, 'revision_id');
|
|
}
|
|
|
|
public function costSnapshots(): HasMany
|
|
{
|
|
return $this->hasMany(ProjectCostSnapshot::class, 'revision_id');
|
|
}
|
|
|
|
public function isApproved(): bool
|
|
{
|
|
return $this->status === self::STATUS_APPROVED;
|
|
}
|
|
}
|