Skip to content

Commit

Permalink
Fix use of make and position is in the wrong place
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofandel authored and ifox committed Oct 21, 2024
1 parent 26297e0 commit 73bfbdd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Repositories/Behaviors/HandleRevisions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
2 changes: 1 addition & 1 deletion src/Repositories/BlockRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down

0 comments on commit 73bfbdd

Please sign in to comment.