Update rows in table (or table) after action on row

i have custom action to reorder categories in my plugin
the db is updated but the ui/table not
any idea?
```
->actions([
Tables\Actions\ActionGroup::make([
Tables\Actions\EditAction::make(),
Tables\Actions\Action::make('moveUp')
->label('Move Up')
->icon('heroicon-o-chevron-up')
->color('success')
->requiresConfirmation()
->action(function (Category $record, $livewire): void {
$query = Category::query()
->where('parent_id', $record->parent_id)
->where('sort_order', '<', $record->sort_order)
->orderBy('sort_order', 'desc');

if ($swapRecord = $query->first()) {
$tempOrder = $record->sort_order;
$record->update(['sort_order' => $swapRecord->sort_order]);
$swapRecord->update(['sort_order' => $tempOrder]);
}
$livewire->getTableRecords()->fresh();
}),
...
])
Was this page helpful?