F
Filament6mo ago
Wim

Navigation for custom page

I created a custom page. Calling it from my resource: public static function getPages(): array { return [ 'approval' => Pages\ApprovalAnimal::route('/approval'), ]; } Then in the Pages]ApprovalAnimal I have class ApprovalAnimal extends ListRecords { protected static string $resource = AnimalResource::class; protected static string $view = 'filament.admin.resources.animal-resource.pages.approval-animal'; function table(Table $table): Table { return $table ... } And in the provider i have ->navigationItems([ NavigationItem::make('Mijn Approvals') ->url(fn (): string => ApprovalAnimal::getUrl()) ->icon('heroicon-o-presentation-chart-line') ->isActiveWhen(fn () => request()->routeIs('filament.admin.resources.animals.approval')) ]) All works, but it seems that also the AnimalResource is active (together with the Approval navigation item). How can I make the AnimalResource inactive? It should not be displayed as red.
No description
4 Replies
Rudi vZ
Rudi vZ6mo ago
I'm not sure, but I would try to use: public static function canAccess(): bool { return false; } on your AnimalResource\Pages\ListPage
Wim
WimOP6mo ago
Does not seem to work
krekas
krekas6mo ago
is active is the same for both pages it means. but in your resource you have only this approval page?
Dennis Koch
Dennis Koch6mo ago
Why do you register the same page as resource and separate page?
Want results from more Discord servers?
Add your server