Answers for "multilevel subcategories in laravel"

0

multilevel subcategories in laravel

<!-- Displaying the current category -->
<li value="{{ $category->id }}">{{ $category->name}}

    <!-- If category has children -->
    @if (count($category->children) > 0)

        <!-- Create a nested unordered list -->
        <ul>

            <!-- Loop through this category's children -->
            @foreach ($category->children as $sub)

                <!-- Call this blade file again (recursive) and pass the current subcategory to it -->
                @include('subcategories', ['category' => $sub])
        
            @endforeach
        </ul>
    @endif
</li>
Posted by: Guest on September-23-2021

Code answers related to "multilevel subcategories in laravel"

Browse Popular Code Answers by Language