From e1ca289359ca6474774b357007e5849933c240d1 Mon Sep 17 00:00:00 2001 From: Sven van Ginkel Date: Tue, 17 Dec 2024 20:37:58 +0100 Subject: [PATCH] Add queries --- app/Filament/Resources/ResultResource.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Filament/Resources/ResultResource.php b/app/Filament/Resources/ResultResource.php index b97148752..ed3f98ce2 100644 --- a/app/Filament/Resources/ResultResource.php +++ b/app/Filament/Resources/ResultResource.php @@ -140,7 +140,6 @@ public static function form(Form $form): Form ->content(fn (Result $result): ?string => $result->comments), Forms\Components\Checkbox::make('scheduled'), Forms\Components\Checkbox::make('healthy'), - ]) ->columns(1) ->columnSpan([ @@ -318,6 +317,7 @@ public static function table(Table $table): Table ->boolean() ->toggleable() ->toggledHiddenByDefault() + ->sortable() ->alignment(Alignment::Center), Tables\Columns\TextColumn::make('created_at') ->dateTime(config('app.datetime_format')) @@ -365,7 +365,12 @@ public static function table(Table $table): Table Tables\Filters\TernaryFilter::make('healthy') ->nullable() ->trueLabel('Only healthy speedtests') - ->falseLabel('Only unhealthy speedtests'), + ->falseLabel('Only unhealthy speedtests') + ->queries( + true: fn (Builder $query) => $query->where('healthy', true), + false: fn (Builder $query) => $query->where('healthy', false), + blank: fn (Builder $query) => $query, + ), ]) ->actions([ Tables\Actions\ActionGroup::make([