Hide widget on dashboard
I probably overlooked something simple, how can we hide a widget from the dashboard ?
I made a stats widget for a page, but its not supposed to be shown on the dashboard aswell, but the dashboard ofcause shows all widgets in the widget folder so ...
7 Replies
move your widgets to another folder
that was my initial idea too, but then its not found.
Unable to find component: [app.filament.page-widgets.usage-overview]
I can hide it using canView and request matching, but its not pretty, since then the loading state of dashboard is wrong
(I have executed composer dump-autoload), but it didnt help in locating the component
Ok, then second option
Customize dashboard https://filamentphp.com/docs/3.x/panels/dashboard#customizing-the-dashboard-page
I have a custom dashboard (otherwise it would show the 2 default widgets), but it still renders all widgets from the widget folder
@Kleis Ever figure this one out? Running into this issue as well... Can't move it out of
app/Filament/Widgets
or comment ->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
in AdminPanelProvider
...widgets are livewire components, so if it isn't autodiscovered you either have to put in it the livewire directory, register it manually in a service provider, or add it to the ->widgets() modifier on the panel.
Here my solution:
Inside your custom Dashboard page add the following function to override the autoload.