id)->delete(); $inhaltsverzeichnis = Inhaltsverzeichnis::get(); foreach ($inhaltsverzeichnis as $inhalt) { $textblock = ''; if ($inhalt->textblock_id > 0) { $textblock = Textblock::where('id', $inhalt->textblock_id)->pluck('textblock')->first(); } ProjektInhaltsverzeichnis::updateOrCreate( [ 'projekte_id' => $record->id, 'name' => $inhalt->name, ], [ 'sort' => $inhalt->sort, 'ordnungszahl' => $inhalt->ordnungszahl, 'name' => $inhalt->name, 'ueberschrift_anzeigen' => $inhalt->ueberschrift_anzeigen, 'tabellen_id' => $inhalt->tabellen_id, 'textblock_id' => $inhalt->textblock_id, 'seite' => $inhalt->seite, 'neue_seite' => $inhalt->neue_seite, 'seitenzahl_anzeige' => $inhalt->seitenzahl_anzeige, 'textblock' => $textblock, ]); } } }