Download the PHP package almirhodzic/nova-sortable-5 without Composer
On this page you can find all versions of the php package almirhodzic/nova-sortable-5. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download almirhodzic/nova-sortable-5
More information about almirhodzic/nova-sortable-5
Files in almirhodzic/nova-sortable-5
Package nova-sortable-5
Short Description A Laravel Nova 5 package for drag-and-drop sorting of resources with an orderable field.
License MIT
Homepage https://novafront.dev
Informations about the package nova-sortable-5
Nova Sortable 5

A Laravel Nova 5 package for drag-and-drop and arrow-based sorting of resources.
- Drag-and-drop reordering via SortableJS
- Up/down arrow buttons for precise ordering
- Visual feedback: green border on moved row, red border on displaced row
- Toast notifications on success/error
- Publishable config for global defaults
- No full page reload — instant DOM updates
Table of Contents
- Requirements
- Installation
- Setup
- 1. Add a sort column to your table
- 2. Add the trait to your Eloquent Model
- 3. Add the trait and field to your Nova Resource
- Configuration
- Field Options
- How it works
- Model Features
- License
Requirements
- PHP ^8.2
- Laravel Nova ^5.0
Installation
The service provider is auto-discovered. No manual registration needed.
Publish the config (optional)
This creates config/frontbyte-nova-sortable.php where you can set global defaults.
Setup
1. Add a sort column to your table
New table:
Existing table — create a migration to add the column:
Then run the migration:
After migrating, you can initialize the order values for existing rows:
2. Add the trait to your Eloquent Model
The $sortableColumn property is optional. If omitted, it uses the default_column from the config (default: order).
3. Add the trait and field to your Nova Resource
The SortableResource trait ensures Nova sorts by your sortable column by default, preventing conflicts with drag-and-drop.
Tip: If you're adding this package to an existing resource with pre-existing rows, their
sort_ordervalues will initially all be0. Simply perform a single drag-and-drop reorder in the admin panel — the package will automatically recalculate and persist thesort_orderfor all rows in the table.
Configuration
After publishing, edit config/frontbyte-nova-sortable.php:
All config values serve as global defaults. You can override them per field (see below).
Field Options
You can override config defaults per resource by chaining methods on the Sortable field:
| Method | Description |
|---|---|
showDragHandle() / hideDragHandle() |
Toggle drag handle visibility |
showSortArrows() / hideSortArrows() |
Toggle arrow buttons |
showOrderNumber() / hideOrderNumber() |
Toggle order number display |
showToast() / hideToast() |
Toggle success/error toast messages |
Auto-assign order on create
By default, the package automatically assigns the next order value (max + 1) when creating a new model. This means every new entry is added to the end of the list.
If you want to control the order value manually (e.g. via a form field), you can disable this:
With auto-assign disabled, you are responsible for setting the sort_order value yourself:
How it works
Drag-and-drop: Grab the bars icon and drag a row to its new position. All affected rows are reordered in a single API call.
Arrow buttons: Click the up/down arrows to swap a row with its neighbor. Only the two affected rows are swapped.
Visual feedback: After sorting, the moved row flashes green and the displaced row flashes red — providing clear visual confirmation of what changed.
No page reload: All updates happen via API calls with instant DOM manipulation. The order numbers update automatically.
Model Features
The HasSortableRows trait provides:
License
MIT License. See LICENSE for details.