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