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.4 Replies
I'm not sure, but I would try to use:
public static function canAccess(): bool
{
return false;
}
on your AnimalResource\Pages\ListPage
Does not seem to work
is active is the same for both pages it means. but in your resource you have only this approval page?
Why do you register the same page as resource and separate page?