#Can I have named routes for a panel
24 messages · Page 1 of 1 (latest)
All routes should be named. You mean whether you can override the name for a route?
no, what I mean is that I would like to substitute the default route('dashboard') with a panel, but even as the panel id is dashboard it does not work as the dashboard panel is not a named route
sure /dashboard works
<div class="pt-2 pb-3 space-y-1">
<x-responsive-nav-link href="{{ route('dashboard') }}" :active="request()->routeIs('dashboard')">
{{ __('Dashboard') }}
</x-responsive-nav-link>
</div>
does not work because the panel does not have a named route
normally in wep.php one have something like this:
Route::get('/dashboard', function () {
return view('dashboard');
})->name('dashboard');
as you can see then name of the route is dashboard
where as a panel does not have a 'name'
if i do:
php artisan route:list
GET|HEAD dashboard ................................................................................................................................................................................................................................ filament.dashboard.pages.dashboard › Filament\Pages › Dashboard
GET|HEAD dashboard-jet .............................................................................................................................................................................................................................................................................. dashboard-jet
```
and as you can see the last is a named route
I don't get it
does not work because the panel does not have a named route
Panels aren't Pages. They cannot have routes.
would like to substitute the default route('dashboard') with a panel,
What do you mean by that? You want a panel named/dashboardnext to another panel?
in a blade view one can do this: {{ route('some-name') }} and some-name is defined as a named route in your web.php
Filament::getPanel('dashboard')->getUrl();
but I cannot do {{ route('dashboard') }} as the Filament pannel does not have named route
yes, but then you cannot do this:
<x-nav-link href="{{ Filament::getPanel('dashboard')->getUrl() }}" :active="request()->routeIs('dashboard')">
{{ __('Dashboard') }}
</x-nav-link>
because the named route 'dashboard' is not defined
Well, then you need to compare the URLs instead of the route names
yes, that is the workaround 🙂
Thank you for marking this question as solved!
Learn more
Not sure you marked your answer as the solution - it does not work
It's the only way to get the actual panel URL. And I thought you said using the URL is a workaround?