Skip to content

Commit 5b7ba57

Browse files
[Bug] Fix filtering on healthy in results table (alexjustesen#1936)
Co-authored-by: Alex Justesen <[email protected]>
1 parent 3f03651 commit 5b7ba57

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/Filament/Resources/ResultResource.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ public static function form(Form $form): Form
140140
->content(fn (Result $result): ?string => $result->comments),
141141
Forms\Components\Checkbox::make('scheduled'),
142142
Forms\Components\Checkbox::make('healthy'),
143-
144143
])
145144
->columns(1)
146145
->columnSpan([
@@ -318,6 +317,7 @@ public static function table(Table $table): Table
318317
->boolean()
319318
->toggleable()
320319
->toggledHiddenByDefault()
320+
->sortable()
321321
->alignment(Alignment::Center),
322322
Tables\Columns\TextColumn::make('created_at')
323323
->dateTime(config('app.datetime_format'))
@@ -365,7 +365,12 @@ public static function table(Table $table): Table
365365
Tables\Filters\TernaryFilter::make('healthy')
366366
->nullable()
367367
->trueLabel('Only healthy speedtests')
368-
->falseLabel('Only unhealthy speedtests'),
368+
->falseLabel('Only unhealthy speedtests')
369+
->queries(
370+
true: fn (Builder $query) => $query->where('healthy', true),
371+
false: fn (Builder $query) => $query->where('healthy', false),
372+
blank: fn (Builder $query) => $query,
373+
),
369374
])
370375
->actions([
371376
Tables\Actions\ActionGroup::make([

0 commit comments

Comments
 (0)