@jecs9, i use route name...
request()->routeIs('dashboard.*')
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
I am trying to activate the current navigation button depending on the active request using {{ Request::is(dashboard/xxxx) ? 'active' : '' }}
I have few pages in the dashboard and some of them have tables, those tables use query strings to identify the page, orderBy specific column and order direction (asc, desc)
The menu get activated properly if there is no query string but as soon as there is then the button is no longer active
For example, if I go directly to dashboard/users then the button is active, but if I order by some column or if I change to page 2 and the url is for example dashboard/users?sortField=referrer.name&sortDirection=asc then the navigation button of dashboard/users is no longer active
Is there a way to ignore the query string to keep showing the navigation button active? I am using Laravel 8
Thank you in advance for your help
but when I interact with the livewire component the url becomes a livewire.message.
It must be living within a livewire component that changes because the rest of the page will be static. Livewire won't change it. So the solution is one of the following...
public $currentDash;
public function mount()
{
$this->currentDash = Route::currentRouteName();
...
}
and for the button(s)...
{{ $currentDash === 'dashboardUsers' ? 'active' : '' }}
// and so on
Please or to participate in this conversation.