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' => [...]
],
...
]
]
Share this post
Laravel Starter Kit Guide
TypedCMS' use of JSON:API specification compliant APIs make it really easy to integrate into any new or existing Laravel project.
The TypedCMS Starter Kit for Laravel is the perfect kick start to your implementation, whether for an existing project or brand new one. Our stater kits are tailored solutions for each platform, unlike the simple API wrappers offered by other vendors.
Our Laravel kit provides Eloquent like models, repositories, query caching and a simple mechanism for adding custom webhook controllers and handlers.