F
Filament7mo ago
Milorn

How to expose table of ManageRelatedRecords to widget

I have a Widget that i'm displaying in the header of a ManageRelatedRecords page, from the widget i want to get access to the table, i used the trait
ExposeTableToWidgets
ExposeTableToWidgets
on the ManageRelatedRecords page and i put that page inside the getTablePage of the widget and i'm getting this error:
Unable to resolve dependency [Parameter #0 [ <required> string|int $record ]] in class Filament\Resources\Pages\ManageRelatedRecords
Unable to resolve dependency [Parameter #0 [ <required> string|int $record ]] in class Filament\Resources\Pages\ManageRelatedRecords
it works fine if in the getTablePage i put a ListRecords class instead of a ManageRelatedRecords, but in my case it's manage related records page, so how can i do that ? and another problem is trying to get the owner record of the ManageRelatedRecords from the widget, right now i'm passing it as a parameter for the make in the getHeader but i don't know if that's ideal
3 Replies
Samer
Samer7mo ago
@Milorn did you find away ? Oh i thought this was an old question just now notice it was one hour , sorry
Milorn
MilornOP7mo ago
@Samer Still on it I'm using a hack for now, i created a ListRecords class just for this purpose And put inside the table that i wanted And i return it from getTablePage in the widget
Samer
Samer7mo ago
thanks inside the ListRecords class i just put this protected static string $relationship = 'Profiles'; then in the widget i use $profile = $this->getPageTableQuery()->getRelation('profiles')->count();
Want results from more Discord servers?
Add your server