bezhanSalleh / filament-google-analytics

Google Analytics integration with Filamentphp (FilamentAdmin)
MIT License
167 stars 29 forks source link

allow widgets to be used in multiple pages #45

Closed kylekanderson closed 10 months ago

kylekanderson commented 1 year ago

It would be useful to use the widgets in the package in multiple Filament pages. Or, to be able to use them in pages not called "Dashboard" (for example, users may want to use them in a separate "Analytics" page).

However, the CanViewWidget Trait (https://github.com/bezhanSalleh/filament-google-analytics/blob/44030360e379f8b0d73eb313d545566b3112bd67/src/Traits/CanViewWidget.php#L16) is currently setup to only allow the widgets to be used in the built-in dashboard or in a Filament page title "Dashboard". This Pull Request updates the Trait to allow the widgets to be used in other Filament pages as well.

bezhanSalleh commented 10 months ago

Thanks, but this isn't required! as you can see from the config, each widget has two options, dashboard filament's default dashboard page and global if you set the global option for a widget to true then you can use it wherever filament allows it.