Answer the question
In order to leave comments, you need to log in
Blade pattern mess?
Hello. In the site menu, I need to display seven categories, and then add a "More" button, and when you hover over it, the rest of the categories will appear.
I started like this:
@if($categories)
@for ($i = 0; $i < count($categories); $i++)
<li><a href="{{ url('/category') . '/' . $categories[$i]['id'] }}">{{ $categories[$i]['name'] }}</a></li>
<?php
if($i == 6) {
$categories = array_splice($categories, 7);
break;
};
?>
@endfor
@endif
Answer the question
In order to leave comments, you need to log in
View Composers are used to separate logic from templates without cluttering up controllers .
Check out this package
https://github.com/spatie/laravel-menu
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question