PHPackages                             pixelcreation/nova-field-sortable - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. pixelcreation/nova-field-sortable

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

pixelcreation/nova-field-sortable
=================================

A Nova field for ordering resources.

3.2.0(4y ago)352.2k↓13%3MITPHPPHP &gt;=8.0

Since Sep 9Pushed 4y agoCompare

[ Source](https://github.com/pixelcreation/nova-field-sortable)[ Packagist](https://packagist.org/packages/pixelcreation/nova-field-sortable)[ RSS](/packages/pixelcreation-nova-field-sortable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (15)Used By (0)

Laravel Nova Sortable Field
===========================

[](#laravel-nova-sortable-field)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d827437034e8715fb73d6c8cb7c8676164762794c8f89186fd618486899e5e51/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706978656c6372656174696f6e2f6e6f76612d6669656c642d736f727461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pixelcreation/nova-field-sortable)[![Total Downloads](https://camo.githubusercontent.com/4e4aac8252cfba681427550413fed7569a9e0bb259f97f9f0d1bc87682a9aa85/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706978656c6372656174696f6e2f6e6f76612d6669656c642d736f727461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pixelcreation/nova-field-sortable)

Description
-----------

[](#description)

This field adds reordering functionality to your resource's index using the awesome [eloquent-sortable](https://github.com/spatie/eloquent-sortable) package by the great people of [Spatie](https://spatie.be).

This package is a fork of [Teatrante/nova-field-sortable](https://github.com/Teatrante/nova-field-sortable), which is a fork of the original package [Naxon/nova-field-sortable](https://github.com/Naxon/nova-field-sortable). It includes improvements to the layout

[![screenshot](https://github.com/PixelCreation/nova-field-sortable/raw/master/docs/screenshot.png)](https://github.com/PixelCreation/nova-field-sortable/raw/master/docs/screenshot.png)

Requirements
------------

[](#requirements)

- Nova 4
- [spatie/eloquent-sortable](https://github.com/spatie/eloquent-sortable) (If not already installed, this package will install if for you and all you have to do is follow the [installation](https://github.com/spatie/eloquent-sortable#installation) instructions).

Installation
------------

[](#installation)

This package can be installed through Composer.

```
composer require pixelcreation/nova-field-sortable
```

Upgrading from v3.x to v4.x
---------------------------

[](#upgrading-from-v3x-to-v4x)

- Instead of the primary key column, you'll need to supply the name of the sort column in the `Sortable` field.

Usage
-----

[](#usage)

1. Follow the [usage instructions](https://github.com/spatie/eloquent-sortable#usage) on the eloquent-sortable repository to make your model sortable.
2. Use the `PixelCreation\NovaFieldSortable\Concerns\SortsIndexEntries` trait in your Nova Resource.
3. Add a public static property called `$defaultSortField` to your resource, containing your sorting column (I recommend adding it in your main `app/Nova/Resource.php` file).
4. Add the `PixelCreation\NovaFieldSortable\Sortable` field to your Nova Resource `fields` method, using a label and your sorting column.

### Example

[](#example)

```
