This commit is contained in:
salam committed 2025-10-31 15:25:16 +01:00
1 parent c64634b3a1
commit 523e395064
36 files changed
+431 -635

No files matched your search

@@ -12,39 +12,34 @@ class CreateProjektInhaltsverzeichnis
{
ProjektInhaltsverzeichnis::where('projekte_id', $record->id)->delete();
$inhaltsverzeichnis = Inhaltsverzeichnis::get();
$part = 1;
foreach ($inhaltsverzeichnis as $inhalt) {
$inhaltsverzeichnis = Inhaltsverzeichnis::orderBy('sort')->get();
foreach ($inhaltsverzeichnis as $key => $value) {
$key++;
$textblock = '';
if ($inhalt->textblock_id > 0) {
$textblock = Textblock::where('id', $inhalt->textblock_id)->pluck('textblock')->first();
if ($value->textblock_id > 0) {
$textblock = Textblock::where('id', $value->textblock_id)->pluck('textblock')->first();
}
if ($inhalt->tabellen_id == 5) {
$part = 2;
}
$inhalt = new ProjektInhaltsverzeichnis;
$inhalt->projekte_id = $record->id;
$inhalt->sort = $key;
$inhalt->ordnungszahl = $value->ordnungszahl;
$inhalt->name = $value->name;
$inhalt->name2 = $value->name2;
$inhalt->ueberschrift_anzeigen = $value->ueberschrift_anzeigen;
$inhalt->tabellen_id = $value->tabellen_id;
$inhalt->textblock_id = $value->textblock_id;
$inhalt->part = $value->part;
$inhalt->seite = $value->seite;
$inhalt->neue_seite = $value->neue_seite;
$inhalt->seitenzahl_anzeige = $value->seitenzahl_anzeige;
$inhalt->no_edit = $value->no_edit;
$inhalt->textblock = $textblock;
$inhalt->save();
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,
]);
}
}
}