Eine Vorlage ist reines Layout (Titelseite mit allein stehendem Titel, Kopf- und Fußgrafik aus dem Medienbestand, Herausgeber und Standardvermerk) und wird dem Dokument zugeordnet. Untertitel, Ausgabe, Veröffentlichungsdatum und Copyright-Vermerk gehören zur Dokumentfassung (document_meta). Ohne Vorlage bleibt das PDF unverändert. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
54 lines
1.5 KiB
PHP
54 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Domain\Catalog;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
/**
|
|
* Vorlage für das PDF eines Dokuments (ADR-51, Nachtrag): Titelseite, grafische Kopf- und Fußzeile und Standardvermerke.
|
|
* Die Vorlage bestimmt nur das Aussehen. Der Inhalt, auch Ausgabe, Datum und Copyright-Vermerk der Dokumentfassung, gehört
|
|
* zur Fassung ({@see DocumentMeta}); die Vorlage liefert nur den Standard-Vermerk, wenn die Fassung keinen eigenen hat.
|
|
*/
|
|
class PdfTemplate extends Model
|
|
{
|
|
public const KIND_DOCUMENT = 'dokument';
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'kind',
|
|
'show_cover',
|
|
'header_version_id',
|
|
'footer_version_id',
|
|
'cover_version_id',
|
|
'publisher',
|
|
'copyright',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return ['show_cover' => 'boolean'];
|
|
}
|
|
|
|
public function headerVersion(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ContentElementVersion::class, 'header_version_id');
|
|
}
|
|
|
|
public function footerVersion(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ContentElementVersion::class, 'footer_version_id');
|
|
}
|
|
|
|
public function coverVersion(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ContentElementVersion::class, 'cover_version_id');
|
|
}
|
|
|
|
public function compositions(): HasMany
|
|
{
|
|
return $this->hasMany(Composition::class);
|
|
}
|
|
}
|