Skip to content

Instantly share code, notes, and snippets.

@jovialcore
Last active November 19, 2025 12:29
Show Gist options
  • Select an option

  • Save jovialcore/60339fd319e7e88b1eb5fe61d780defd to your computer and use it in GitHub Desktop.

Select an option

Save jovialcore/60339fd319e7e88b1eb5fe61d780defd to your computer and use it in GitHub Desktop.
Hook into the reoderbale action for filament tables
<?php
// To hook into the saving lifecyle when table rows are reodered in filament tables, all you need is this method, then you can insert the ordering integers to, say, a different table.
public function reorderTable(array $order): void
{
//e.g:
foreach ($order as $orderId => $id) {
DB::table('table')
->where('column_id', $id)
->update(['order' => $position]);
}
}
@jovialcore
Copy link
Author

Please refer to the documentation for an overview about reoderable records : https://filamentphp.com/docs/4.x/tables/overview#reordering-records

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment