Laravel

Livewire Sortable Drag and Drop

January 16, 2026 1 min read 47 views

Drag and drop sorting:

Install SortableJS

npm install sortablejs

Component

public $items = [];

public function updateOrder($orderedIds)
{
    foreach ($orderedIds as $index => $id) {
        Item::find($id)->update(['order' => $index]);
    }
}

View with Alpine

@foreach($items as $item)
{{ $item->name }}
@endforeach
Share this post:

Related Posts

Comments (0)

Please log in to leave a comment. Log in

No comments yet. Be the first to comment!