*/ use HasFactory; public const ALL_VARIATIONS = 'all'; protected $fillable = [ 'project_id', 'shop_id', 'listing_id', 'variation_key', 'title_snapshot', 'state_snapshot', 'remote_updated_at', 'synced_at', 'live_release_id', 'lock_version', 'created_by', 'detached_at', ]; protected function casts(): array { return [ 'remote_updated_at' => 'datetime', 'synced_at' => 'datetime', 'detached_at' => 'datetime', ]; } public function project(): BelongsTo { return $this->belongsTo(Project::class); } public function liveRelease(): BelongsTo { return $this->belongsTo(ProjectRelease::class, 'live_release_id'); } public function creator(): BelongsTo { return $this->belongsTo(User::class, 'created_by'); } public function isDetached(): bool { return $this->detached_at !== null; } }