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.
63 lines
1.4 KiB
PHP
63 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Database\Factories\ProjectFactory;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Project extends Model
|
|
{
|
|
/** @use HasFactory<ProjectFactory> */
|
|
use HasFactory;
|
|
|
|
/** @var list<string> */
|
|
public const STAGES = ['design', 'ready', 'live', 'retired'];
|
|
|
|
protected $fillable = ['reference', 'title', 'notes', 'stage', 'currency', 'created_by', 'archived_at'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'archived_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function creator(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
|
|
public function revisions(): HasMany
|
|
{
|
|
return $this->hasMany(ProjectRevision::class);
|
|
}
|
|
|
|
public function listingLinks(): HasMany
|
|
{
|
|
return $this->hasMany(ProjectListingLink::class);
|
|
}
|
|
|
|
public function releases(): HasMany
|
|
{
|
|
return $this->hasMany(ProjectRelease::class);
|
|
}
|
|
|
|
public function costSnapshots(): HasMany
|
|
{
|
|
return $this->hasMany(ProjectCostSnapshot::class);
|
|
}
|
|
|
|
public function events(): HasMany
|
|
{
|
|
return $this->hasMany(ProjectEvent::class)->latest('created_at');
|
|
}
|
|
|
|
public function isArchived(): bool
|
|
{
|
|
return $this->archived_at !== null;
|
|
}
|
|
}
|