Skip to content

Commit 2ccc45a

Browse files
committed
fix: add toArray method to NavigationDto for proper serialization of children
1 parent 79609d4 commit 2ccc45a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/Dtos/NavigationDto.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,12 @@ public function hasChildren(): bool
7070
{
7171
return $this->children->isNotEmpty() && $this->type == 'group';
7272
}
73+
74+
public function toArray(): array
75+
{
76+
$list = parent::toArray();
77+
$list['children'] = $this->children->map(fn ($child) => $child->toArray())->all();
78+
unset($list['translatableAttributes']);
79+
return $list;
80+
}
7381
}

0 commit comments

Comments
 (0)