whereKey($member->composition_version_id)->value('status'); if (StatusValue::of($status) === ContentVersionStatus::Bereit->value) { throw new DomainRuleException('Eine bestätigte Kompositionsfassung nimmt keine weiteren Mitglieder auf.'); } }); static::updating(function (): void { throw new DomainRuleException('Mitglieder einer Komposition werden nicht verändert, sondern durch eine neue Fassung ersetzt.'); }); } public function compositionVersion(): BelongsTo { return $this->belongsTo(CompositionVersion::class); } public function contentElementVersion(): BelongsTo { return $this->belongsTo(ContentElementVersion::class); } public function nestedCompositionVersion(): BelongsTo { return $this->belongsTo(CompositionVersion::class, 'nested_composition_version_id'); } }