you will need just the children relationship when rendering the view. something like this would do.
file tree_entry.blade.php
<ul>
@foreeach($entries as $entry)
<li>
<a href="">{{ $entry->category_name }}</a>
@if($entry->children->count())
@include ('tree_entry', ['entries' => $entry->children]);
@endif
<li>
@endforeeach
</ul>
<ul>
@each('admin.partials.category-tree', $categories, 'category')
</ul>
partial
<li>{{ $category['category_name'] }}</li>
@if (count($category['children']) > 0)
<ul>
@foreach($category['children'] as $category)
@include('admin.partials.category-tree', $category)
@endforeach
</ul>
@endif
This worked for me.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community