Answer the question
In order to leave comments, you need to log in
How to make a drop down menu in Laravel?
Good day everyone.
Please help me with this design. I have a drop down menu code
<div class="inbox content">
<ul>
@foreach($sitemap->where('parent', 0) as $item)
<li>
<a href="{{ $item->alias }}">{{ $item->title }}</a>
@if($sitemap->where('parent', '>', 0)->count() > 0)
<ul>
@foreach($sitemap->where('parent', $item->id) as $value)
<li><a href="{{ $value->alias }}">{{ $value->title }}</a></li>
@endforeach
</ul>
@endif
</li>
@endforeach
</ul>
</div>
<ul>
<li>
Answer the question
In order to leave comments, you need to log in
It will always be true here if there is at least 1 element with parent > 0 in $sitemap.
You need to change the design so that the check is for elements that have parent === $item->id, for example, as in the next foreach.
This article should answer your question: href=" https://appdividend.com/2018/02/23/laravel-5-6-cru... ">
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question