wip
This commit is contained in:
1 parent
7eaa8c0da2
commit
c149ed0a9f
15 files changed
+157
-77
No files matched your search
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Create;
|
||||
|
||||
use App\Models\Inhaltsverzeichnis;
|
||||
use App\Models\ProjektInhaltsverzeichnis;
|
||||
use App\Models\Textblock;
|
||||
|
||||
class CreateProjektInhaltsverzeichnis
|
||||
{
|
||||
public static function create($record)
|
||||
{
|
||||
$inhaltsverzeichnis = Inhaltsverzeichnis::with('textblock_kennung')->get();
|
||||
foreach ($inhaltsverzeichnis as $inhalt) {
|
||||
ProjektInhaltsverzeichnis::updateOrCreate(
|
||||
[
|
||||
'projekte_id' => $record->id,
|
||||
'name' => $inhalt->name,
|
||||
],
|
||||
[
|
||||
'sort' => $inhalt->sort,
|
||||
'ordnungszahl' => $inhalt->ordnungszahl,
|
||||
'seite' => $inhalt->seite,
|
||||
'textblock_kennung_id' => $inhalt->textblock_kennung_id,
|
||||
'textblock' => Textblock::where('id', $inhalt->textblock_kennung_id)->pluck('textblock')->first(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user