Error while trying to adapt a v2 pattern to v3

We used this pattern to show multiple lists for the same resource in the navigation bar:
->navigation(function (NavigationBuilder $builder): NavigationBuilder {
return $builder
->groups([
NavigationGroup::make('Users')
->items([
...ListCustomers::getNavigationItems(),
...ListPartners::getNavigationItems(),
...ListStaff::getNavigationItems(),
]),
]);
})
->navigation(function (NavigationBuilder $builder): NavigationBuilder {
return $builder
->groups([
NavigationGroup::make('Users')
->items([
...ListCustomers::getNavigationItems(),
...ListPartners::getNavigationItems(),
...ListStaff::getNavigationItems(),
]),
]);
})
ListCustomers and all those other classes extend a UserList class, with different tables. When I try to use this, i get a "Route [filament.admin.pages.list-customers] not defined.". I tried registering the classes in the getPages function of the UserResource, but when i do so, thei create a route under filament.admin.resource.list-customers, not filament.admin.pages.list-customers. If I edit the function "getRouteName" inside the Page function, it works as I would assume. What am I doing wrong? Why are they registered under resources instead of pages? how can I register the routes for this lists under the pages route?
5 Replies
Patrick Boivin
Patrick Boivin15mo ago
Do you have Customers / Partners / Staff resources?
InSeriousNeedOfHelp
InSeriousNeedOfHelpOP15mo ago
@pboivin No I extended the UserList page, avoiding creating 3 different resources that would all relate to the same Eloquent Model, which would be user
Patrick Boivin
Patrick Boivin15mo ago
Ok, makes sense. If ListCustomers extends ListUsers, it sounds like it should belong in the UserResource, and count as a resource page. Am I understanding this correctly?
InSeriousNeedOfHelp
InSeriousNeedOfHelpOP15mo ago
Yes patrick, that would be the case, anyway I followed your first suggestion and created multiple resources linked to the model, as to have more granular control over the forms. Still, how would someone register a page in the filament.admin.page route/namespace?
Patrick Boivin
Patrick Boivin15mo ago
I think custom pages (not resource pages) get assigned to the filament.admin.page route prefix
Want results from more Discord servers?
Add your server