whereKey($item->bundle_version_id)->value('status'); if (StatusValue::of($status) === BundleStatus::Veroeffentlicht->value) { throw new DomainRuleException('Eine veröffentlichte Paketfassung nimmt keine weiteren Bestandteile auf.'); } }); static::updating(function (): void { throw new DomainRuleException('Bestandteile einer Paketfassung sind unveränderlich.'); }); } public function bundleVersion(): BelongsTo { return $this->belongsTo(BundleVersion::class); } public function article(): BelongsTo { return $this->belongsTo(LicenseArticle::class, 'license_article_id'); } public function nestedBundle(): BelongsTo { return $this->belongsTo(Bundle::class, 'nested_bundle_id'); } }