F
Filament16mo ago
ehbfa

Route [filament.admin.pages.dashboard] not defined.

I have a custom Dashboard page:
<?php

namespace App\Filament\Pages;

use Filament\Pages\Dashboard as BasePage;

class Dashboard extends BasePage
{

protected static ?string $slug = 'dashboard';

public function getColumns(): int | array
{
return 4;
}

}
<?php

namespace App\Filament\Pages;

use Filament\Pages\Dashboard as BasePage;

class Dashboard extends BasePage
{

protected static ?string $slug = 'dashboard';

public function getColumns(): int | array
{
return 4;
}

}
And it registers itself, as I can see in the sail artisan route:list command:
GET|HEAD admin .................................................................................................................................................................... filament.admin.pages.dashboard › App\Filament\Pages\Dashboard
GET|HEAD admin .................................................................................................................................................................... filament.admin.pages.dashboard › App\Filament\Pages\Dashboard
So the name it is given is filament.admin.pages.dashboard. But when I do this call in AdminPanelProvider:
->navigationItems([
NavigationItem::make('Mijn Score')
->icon('heroicon-o-home')
->activeIcon('heroicon-s-home')
->isActiveWhen(fn (): bool => request()->routeIs('filament.pages.dashboard'))
->url(route('filament.admin.pages.dashboard')),
->navigationItems([
NavigationItem::make('Mijn Score')
->icon('heroicon-o-home')
->activeIcon('heroicon-s-home')
->isActiveWhen(fn (): bool => request()->routeIs('filament.pages.dashboard'))
->url(route('filament.admin.pages.dashboard')),
I get the error Route [filament.admin.pages.dashboard] not defined. ?
Solution:
Try adding a closure inside “url()”
Jump to solution
7 Replies
Solution
Andrew Wallo
Andrew Wallo16mo ago
Try adding a closure inside “url()”
Andrew Wallo
Andrew Wallo16mo ago
So “url(fn() => route(…))”
ehbfa
ehbfaOP16mo ago
Thanks! Solved it
Dennis Koch
Dennis Koch16mo ago
Explanation: This is a ServiceProvider and Laravle is still booting, so the routes are not registered yet.
Andrew Wallo
Andrew Wallo16mo ago
Yeah so it should be documented that way.
Dennis Koch
Dennis Koch16mo ago
Is there an error in the docs? Then please PR a fix.
Andrew Wallo
Andrew Wallo16mo ago
Yeah there are no closures shown in the docs for user and tenant menu items which is why I have seen so many help post related to this. I already submitted a PR 3 days ago but no response
Want results from more Discord servers?
Add your server