© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
2 replies
morty

Typed property Filament\Tables\Filters\BaseFilter::$table must not be accessed before initialization

I have a ListRecords page with a table and 3 stat widgets. The widgets are setup to interact with the filtered table via the
ExposesTableToWidgets
ExposesTableToWidgets
and
InteractsWithPageTable
InteractsWithPageTable
traits . The table has 9 different filters. 8 out of these 9 filters work great and filter the table and the widgets react to the filtered table.

However, one of these filters, the only one that is a relationship to the data causes an exception to be thrown.

I'm not sure how to even begin troubleshooting this but this is the filter causing an issue:

Tables\Filters\SelectFilter::make('account')
    ->label('Account')
    ->placeholder('All')
    ->relationship('account', 'name')
    ->searchable(),
Tables\Filters\SelectFilter::make('account')
    ->label('Account')
    ->placeholder('All')
    ->relationship('account', 'name')
    ->searchable(),


If I turn off the widget
ExposesTableToWidgets
ExposesTableToWidgets
and
InteractsWithPageTable
InteractsWithPageTable
traits, the filter works to filter the table so it's not an issue with the filter. I believe there is an issue with possibly using a relationship filter and those traits. Anyone here successful in achieving this?
CleanShot_2024-08-01_at_08.10.58.png
Solution
I managed to solve this. I'm using
kenneth-sese-advanced-tables
kenneth-sese-advanced-tables
plugin and it turns out I had to use the exact column name as the filter name. Therefore adding
account.name
account.name
to the make method resolved my issue.

Tables\Filters\SelectFilter::make('account.name')
    ->label('Account')
    ->placeholder('All')
    ->relationship('account', 'name')
    ->searchable(),
Tables\Filters\SelectFilter::make('account.name')
    ->label('Account')
    ->placeholder('All')
    ->relationship('account', 'name')
    ->searchable(),
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Typed property Filament\Widgets\TableWidget::$table must not be accessed before initialization.
FilamentFFilament / ❓┊help
3y ago
typed property $table must not be accessed before inicialization
FilamentFFilament / ❓┊help
3y ago
Table must not be accessed before initialization
FilamentFFilament / ❓┊help
14mo ago
Typed property Filament\Support\Assets\Asset::$package must not be accessed before initialization
FilamentFFilament / ❓┊help
2y ago