Eager loaded relationship based on table filter
I'm trying to load a relationship based on the table filter.
In v2 I could do this but in v3 throws error:
Typed property Filament\Widgets\TableWidget::$table must not be accessed before initializationWhen I switch over to using table method with filters the
when
is called but the eager relationship is never loaded causing error:
Attempted to lazy load [language] on modelTried to access the filter via livewire
$table->getLivewire()->getTableFilterState('language_id')
but this causes a recursive loop 500 error. Also tried $this->getTableFilterState('language_id')['value'] ?? null;
1 Reply
I see why I can't use eager loading from inside a filter query now because they are wrapped in a where clause. Still not sure how I would get the table filter from inside
query()
Digging into Filters I see there's modifyBaseQueryUsing
exactly what I needed working perfectly now.