May 5, 2025
0
Level 1
Filament table Filter with default ID
Hi
I have a HouseRessource with multiple Filter.
class HouseResource extends Resource
{
protected static ?string $model = House::class;
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
->where('category_id', '=', request()->input('category_id'));
}
public static function table(Table $table): Table
{
return $table
->columns([
//....
])
->filters([
SelectFilter::make('status')
->label('Status')
->options(HouseStatus::class)
->multiple(),
//....
]);
}
If I select multiple Status, category_id is not longer used. After a page Refresh I have the correct category_id and all my filteres status.
What is the best solution, so define a category_id insite my ressource, because it is important that this ressource use the selected category
Edit: I think the problem is request()->input('category_id') If i write it hardcodet as 10 it works
Please or to participate in this conversation.