SelectFilter doesn not work like I want

Hello I have a select filter
Tables\Filters\SelectFilter::make('status_filter')
  ->options(JobStatusEnum::asSelectArray())
  ->modifyQueryUsing(function (mixed $state, Builder $query): Builder {
    return $query->where('status', $state);
  }),

And it's work, but when I not have any selected option I dont have a any record in table. How I can fix them?
Solution
I think you can use $query->when(..) like this example
Was this page helpful?