Duplicate widgets on dashboard (with properties)
Hey,
I'm trying to have multiple widgets on the dashboard. But if you duplicate a class in the widgets() array in the AdminPanelProvider, it gets ignored. So I think I could do something via the getWidgets() method in my own Dashboard class. And then return a couple of widgets (which can be duplicates it seems). But to pass a property to that class (to tell the class what question it is linked to) I would have to use a WidgetConfiguration I guess? I tried something like this;
new WidgetConfiguration('App\Filament\Widgets\TenantCards', [
'test' => 'hello',
]),
But then when I do this;
dd($this->getPropertyValue('hoi'));
i get:
Property [$test] not found on component: [app.filament.widgets.tenant-cards]
So how would I fetch that property? And know within that class which question it is referring to?
1 Reply
Just like this:
TenantCards::make(['test' => 'hello'])
. Then you can just do $this->test
in the widget class to access the prop.