CI Feature / test (push) Successful in 3m32s
Neuer kind 'exercise', Varianten je Fassung, Verwendung (erforderlich/ergänzend) und Variantenauswahl am einbindenden Mitglied; der Stand schreibt nur gewählte Varianten fest. Änderungsnachweis über structure_hash. Formatierte Anleitung im Mitgliederbereich und PDF (Fußzeile, Metadaten, Ausgabenachweis, keine gespeicherten Kopien); Sperre trifft nur das Medium. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Domain\Catalog;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class ReleaseContent extends Model
|
|
{
|
|
protected $fillable = [
|
|
'article_release_id',
|
|
'position',
|
|
'content_element_version_id',
|
|
'role',
|
|
'path',
|
|
'requirement',
|
|
'variant_key',
|
|
];
|
|
|
|
protected static function booted(): void
|
|
{
|
|
static::creating(function (ReleaseContent $content): void {
|
|
$status = StatusValue::of(ArticleRelease::query()->whereKey($content->article_release_id)->value('status'));
|
|
|
|
if ($status !== ReleaseStatus::Entwurf->value) {
|
|
throw new DomainRuleException('Der Inhalt eines Artikel-Stands wird nur im Entwurf festgeschrieben.');
|
|
}
|
|
});
|
|
|
|
static::updating(function (): void {
|
|
throw new DomainRuleException('Der festgeschriebene Inhalt eines Artikel-Stands ist unveränderlich.');
|
|
});
|
|
}
|
|
|
|
public function release(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ArticleRelease::class, 'article_release_id');
|
|
}
|
|
|
|
public function elementVersion(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ContentElementVersion::class, 'content_element_version_id');
|
|
}
|
|
}
|