Last active
November 19, 2025 12:29
-
-
Save jovialcore/60339fd319e7e88b1eb5fe61d780defd to your computer and use it in GitHub Desktop.
Hook into the reoderbale action for filament tables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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]); | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please refer to the documentation for an overview about reoderable records : https://filamentphp.com/docs/4.x/tables/overview#reordering-records