Discover panel widgets without adding to primary dashboard page
I am trying to discover a number of components (that are used on custom pages) in a panel.
However, if I use
discoverWidgets
they are automatically registered to the landing dashboard page no matter what I set in the ->widgets()
or in the getHeaderWidgets()
of the main dashboard.
If I don't add the parent path of panel widgets to the discoverWidgets
then the other pages cannot find the widget components.
I've tried to access the discoverComponents()
method directly to register the widgets, but it is a protected. Please help π8 Replies
Have you tried a custom dashboard page?
https://filamentphp.com/docs/3.x/panels/dashboard#customizing-the-dashboard-page
Yup! That's where I have tried to manually set the Dashboard widgets using
getHeaderWidgets
So you can have auto-discovery and customize the widgets on a specific dashboard. What is the remaining issue?
This seems to override the dashboard widgets to all the widgets in the panel
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
I only want the widgets in
->discoverWidgets(in: app_path('Filament/Widgets/Dashboard'), for: 'App\\Filament\\Widgets\\Dashboard')
on the dashboard
But if I do that then the other (page) widgets are not discoverable for the other pages anymoreOn your custom dashboard, have you tried something like this?
Aha! Ok that worked π
That overwrote the discovered widgets
I was trying with header and footer widget method
Right, yeah. I just noticed that too in the base Dashboard class π
Thank you so much πͺ