From 73bfbdd7325c0fa02dc1b84a8d348a1f45bfe8d4 Mon Sep 17 00:00:00 2001 From: Tofandel Date: Tue, 15 Oct 2024 18:22:16 +0200 Subject: [PATCH] Fix use of make and position is in the wrong place --- src/Repositories/Behaviors/HandleRevisions.php | 4 ++-- src/Repositories/BlockRepository.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Repositories/Behaviors/HandleRevisions.php b/src/Repositories/Behaviors/HandleRevisions.php index c8a9cbd5e..3e489315f 100644 --- a/src/Repositories/Behaviors/HandleRevisions.php +++ b/src/Repositories/Behaviors/HandleRevisions.php @@ -158,10 +158,10 @@ public function hydrateRelatedBrowsers(TwillModelContract $object, array $fields foreach ($relatedBrowsers as $browser) { $browserField = $fields['browsers'][$browser['browserName']] ?? []; + $position = 1; foreach ($browserField as $values) { - $position = 1; - $relatedBrowserItems->push(RelatedItem::make([ + $relatedBrowserItems->push(new RelatedItem([ 'subject_id' => $object->getKey(), 'subject_type' => $object->getMorphClass(), 'related_id' => $values['id'], diff --git a/src/Repositories/BlockRepository.php b/src/Repositories/BlockRepository.php index 2fdceae7f..c8fff3531 100644 --- a/src/Repositories/BlockRepository.php +++ b/src/Repositories/BlockRepository.php @@ -35,7 +35,7 @@ public function hydrate(TwillModelContract $model, array $fields): TwillModelCon { $relatedItems = collect($fields['browsers']) ->flatMap(fn($items, $browserName) => collect($items) - ->map(fn($item, $position) => RelatedItem::make([ + ->map(fn($item, $position) => new RelatedItem([ 'subject_id' => $model->getKey(), 'subject_type' => $model->getMorphClass(), 'related_id' => $item['id'],