diff --git a/app/Actions/Create/CreateProjektInhaltsverzeichnis.php b/app/Actions/Create/CreateProjektInhaltsverzeichnis.php index b003a18..a50dabb 100644 --- a/app/Actions/Create/CreateProjektInhaltsverzeichnis.php +++ b/app/Actions/Create/CreateProjektInhaltsverzeichnis.php @@ -17,7 +17,6 @@ class CreateProjektInhaltsverzeichnis foreach ($inhaltsverzeichnis as $key => $value) { $key++; - $text = Textblock::where('id', $value->textblock_id)->first(); $inhalt = new ProjektInhaltsverzeichnis; $inhalt->projekte_id = $record->id; $inhalt->inhaltsverzeichnis_id = $value->id; @@ -32,8 +31,12 @@ class CreateProjektInhaltsverzeichnis $inhalt->neue_seite = $value->neue_seite; $inhalt->no_edit = $value->no_edit; $inhalt->textblock_name = $text->name ?? ''; + + $text = Textblock::where('id', $value->textblock_id)->first(); + $inhalt->textblock = $text->textblock ?? ''; $inhalt->textblock2 = $text->textblock2 ?? ''; + $inhalt->save(); } diff --git a/resources/views/pages/textblock.blade.php b/resources/views/pages/textblock.blade.php index 26a02c3..05bd6e0 100644 --- a/resources/views/pages/textblock.blade.php +++ b/resources/views/pages/textblock.blade.php @@ -20,7 +20,9 @@ use Illuminate\Support\HtmlString; @endif - {{ new HtmlString(RichContentRenderer::make($record->textblock)->toHtml()) }} + @if (isset($record->textblock)) + {{ new HtmlString(RichContentRenderer::make($record->textblock)->toHtml()) }} + @endif textblock2 != ""){ @@ -35,7 +37,9 @@ if($record->textblock2 != ""){ Textblock Abschnitt B @endif - {{ new HtmlString(RichContentRenderer::make($record->textblock2)->toHtml()) }} + @if (isset($record->textblock2)) + {{ new HtmlString(RichContentRenderer::make($record->textblock2)->toHtml()) }} + @endif