Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kkontroll's avatar

Left menu dependent on top menu item

Is there a solution for having a top menu that triggers a left menu? Each top menu items triggers different left menus. And while navigating the left menu keeping the top menu item active.

Was looking at: https://github.com/lavary/laravel-menu ... but can't figure out how to do it.

I'm open for using other modules or custom code to accomplish this.

Any tips?

0 likes
3 replies
Borisu's avatar

Well I think you want some JS solution and not a php one. It's the only way to reload the content of the left menu without reloading the page. Otherwise it's simple: when hovering element A, show menu linked to element A etc.

1 like
kkontroll's avatar

Reloading the page is no problem. Each top-menu item goes to the same page as first item in left-menu.

36864's avatar

A simple way to do it would be in your side menu template, expand options based on the current route, something like

@foreach($menuoptions as $option)
<li>{{$option}}</li>
@if(Route::current() === $option)
@foreach($submenuoptions as $suboption)
<li>{{$suboption}}</li>
@endforeach
@endif
@endforeach

Adjust tags according to your menu structure

Please or to participate in this conversation.