Version 1.5.5 of the TypeDCMS Starter Kit for Laravel has been released
This release introduces a nice little helper function for retrieving hierarchies.
This release provides a simple helper function on repositories for retrieving hierarchies as a tree of constructs.
Previously you'd call all() specifying the hierarchy, something like this:
$navItems = $navRepo->all(['hierarchy' => 'primary-navigation'])->getData();
And it would then be necessary to restructure these constructs based on the
hierarchy meta. Now this is all wrapped up in the new hierarchy() method.
$navItemTree = $navRepo->heirarchy('primary-navigation');
Which outputs Construct models in a tree structure ready for traversal.
[
'construct' => Construct,
'children' => [
[
'construct' => Construct,
'children' => [...]
],
...
]
]