Führe PDF-Vorlagen für Dokumente ein: Titelseite, grafischer Kopf und Fuß, Angaben je Fassung (ADR-51, Nachtrag)
Deploy Test / test (push) Successful in 3m21s
Deploy Test / deploy (push) Successful in 27s

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>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-24 14:28:34 +01:00
1 parent 81037b9868
commit 765b8e779e
31 files changed
+1272 -33

No files matched your search

@@ -0,0 +1,55 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* PDF-Vorlagen für Dokumente (ADR-51, Nachtrag), rein additiv:
*
* - `pdf_templates`: Titelseite, Kopf- und Fußgrafik und Standardvermerke. Die Bilder verweisen auf freigegebene Bildfassungen
* des Medienbestands.
* - `compositions.pdf_template_id`: welche Vorlage ein Dokument verwendet (leer = bisheriges Layout).
* - `composition_versions.document_meta`: Untertitel, Ausgabe (Release), Veröffentlichungsdatum und Copyright-Vermerk einer
* Dokumentfassung. Sie sind Teil der Fassung und damit versioniert.
*
* Der Rückfall auf den vorherigen Programmstand setzt nur den Code zurück. Dieser kennt die Spalten und die Tabelle nicht;
* ohne Vorlage und ohne Angaben erzeugt er dasselbe PDF wie bisher.
*/
return new class extends Migration
{
public function up(): void
{
Schema::create('pdf_templates', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('kind')->default('dokument');
$table->boolean('show_cover')->default(true);
$table->foreignId('header_version_id')->nullable()->constrained('content_element_versions')->nullOnDelete();
$table->foreignId('footer_version_id')->nullable()->constrained('content_element_versions')->nullOnDelete();
$table->foreignId('cover_version_id')->nullable()->constrained('content_element_versions')->nullOnDelete();
$table->string('publisher')->nullable();
$table->text('copyright')->nullable();
$table->timestamps();
});
Schema::table('compositions', function (Blueprint $table) {
$table->foreignId('pdf_template_id')->nullable()->constrained('pdf_templates')->nullOnDelete();
});
Schema::table('composition_versions', function (Blueprint $table) {
$table->json('document_meta')->nullable();
});
}
public function down(): void
{
Schema::table('composition_versions', function (Blueprint $table) {
$table->dropColumn('document_meta');
});
Schema::table('compositions', function (Blueprint $table) {
$table->dropConstrainedForeignId('pdf_template_id');
});
Schema::dropIfExists('pdf_templates');
}
};