We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4b1f948 commit ae90e9dCopy full SHA for ae90e9d
src/Components/Forms/PageBuilder.php
@@ -336,13 +336,15 @@ public function relationship(
336
$existingIds = $query->clone()->pluck('id');
337
338
$recordsNeedingDeletion = $existingIds->diff(collect($state)->pluck('id'));
339
+
340
try {
341
DB::beginTransaction();
342
$query->clone()->whereIn('id', $recordsNeedingDeletion)->delete();
343
344
$record->{$this->relationship}()->upsert(array_map(function ($item) {
345
$item['updated_at'] = now()->format('Y-m-d H:i:s');
346
$item['created_at'] = (new Carbon($item['created_at'] ?? null))->format('Y-m-d H:i:s');
347
348
return [
349
...$item,
350
'data' => json_encode($item['data'] ?? []),
0 commit comments