Laravel - Active Route - Prefix Wildcard #642
-
This works great for the page, however I've grouped routes with prefixes. I want to check it against the parent prefix of the route. How could I modify this? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
If you have route names like |
Beta Was this translation helpful? Give feedback.
-
I've grouped routes like below with a prefix.
I have a top nav bar. There is top a level item in the nav, I want it to be highlighted if current route has the "sl" prefix. I would say there is about more than 50 routes. Routes are not really named in the way you mentioned. Is that the only way to do it? |
Beta Was this translation helpful? Give feedback.
Yeah Ziggy's 'current' functionality only works with named routes. If your routes all start with
/sl/
but aren't namedsl.*
you don't really need Ziggy to make those checks, you could do something likelocation.pathname.startsWith('/sl/')
.