the sort of the status filed is not work
alihesahm opened this issue · 1 comments
alihesahm commented
in the filament resources the sort of the status filed is not work
croustibat commented
"Status" is a computed attribute. so i remove sortable and add a filter :
->filters([
SelectFilter::make('status')
->options([
'running' => 'Running',
'succeeded' => 'Succeeded',
'failed' => 'Failed',
])
->query(function (Builder $query, array $data) {
if ($data['value'] === 'succeeded') {
return $query
->whereNotNull('finished_at')
->where('failed', 0);
}
else if ($data['value'] === 'failed') {
return $query
->whereNotNull('finished_at')
->where('failed', 1);
}
else if ($data['value'] === 'running') {
return $query
->whereNull('finished_at');
}
}),
]);
I'll release the fix in few days ;)