Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Metronics Laravel Sidebar Menu


Hello,

I am trying to figure out how to make a menu show as active if I am on a details page. Example:

Users Main Menu
- Create New User - /users/create
- View All Users -/users/index

the above is in config/global/menu.php

So if I select a specific user and end up at /users/show/155

The users menu collapses as there is not a menu item for show, but is there a way to make the Users Main Menu stay open and highlight View All Users?


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (9)


I just saw I can do it through:


KTUtil.onDOMContentLoaded(function() {
KTMenu.updateByLinkAttribute(window.location.pathname);
});


Is there a more dynamic way to do it within the menu file? Or is this the best option?



Hi,

Apologise for the delay. May I know which Metronic version you using? Looks like you are using the legacy Laravel.

Thanks



Yes, im using the legacy Laravel version



Hi,

I apologize for the delay. I'd like to inform you that we no longer provide support for new features in the legacy Laravel version. However, we are here to assist you with any issues you encounter.

It seems like your current workaround of using KTUtil.onDOMContentLoaded and KTMenu.updateByLinkAttribute is a great approach to dynamically highlighting the active menu item based on the URL. Unfortunately, within the menu file itself, the dynamic menu highlight in the user page might be limited in the legacy Laravel version.

If you have any further questions or need assistance with any issue, please don't hesitate to ask. We're here to help!

Thanks



Hello,

Im sorry, I am not on an old version of the laravel theme, I just got this within the last few months.



I apologize for any inconvenience caused by the delay. I appreciate your response. To ensure you're using the latest and most up-to-date version, could you please confirm if you are using Metronic version 8.2.0?

You can always download the latest version of the Metronic Starter Kit from the following link:

https://devs.keenthemes.com/metronic/laravel



Yes, I am using version 8.2



Hi,

In the latest Metronic Laravel Starterkit v8.2.0, the file config/global/menu.php is no longer present. It's important to note that you might be using a legacy version of Metronic Laravel.

If you have access to our GitHub, the config folder does no longer have this folder;
https://github.com/KeenthemesHub/Metronic/tree/master/laravel/laravel_demo1/starterkit/config

Thanks



OK gotcha, sorry it took me a minute to catch that.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(