Support the ongoing development of Laravel.io →
Eloquent Blade
Last updated 2 years ago.
0

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>
0
			<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.

Last updated 8 years ago.
0

even better

0

Sign in to participate in this thread!

Eventy

Your banner here too?

axicraw axicraw Joined 11 Sep 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.