Filter table with metadata column

Hi everyone,

I have a table where the displayed information is from the primary table + joined column from the metadata table. My Select Filters work for the columns on the main table, but when I run my select filter on the joined metadata table, I get an error stating the column 'status' cannot be found on the table.


Attribute on the primary table model
protected function status(): Attribute { return Attribute::make( get: fn () => $this->attributes()->where('key', 'status')->first()->value ?? null, set: fn ($value) => $this->attributes()->updateOrCreate(['key' => 'status'], ['value' => $value]) ); }
Column on the Primary Table
SelectColumn::make('status') ->options(ResourceOption::where('resource', 'renewals')->get()->keyBy('id')->map(fn ($item) => $item->name)->toArray()) ->placeholder(''),
Select Filter on the Primary Table for the Metadata column
SelectFilter::make('status') ->options( ResourceOption::where('resource', 'renewals') ->where('type', 'status') ->get() ->keyBy('id') ->map(fn ($item) => $item->name) ->toArray() ) ->multiple(),
Was this page helpful?