PHPackages                             naxon/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. naxon/nova-field-sortable

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

naxon/nova-field-sortable
=========================

A Laravel Nova field.

v1.0.4(7y ago)59271.8k↑84.2%25[4 issues](https://github.com/Naxon/nova-field-sortable/issues)[1 PRs](https://github.com/Naxon/nova-field-sortable/pulls)MITPHPPHP &gt;=7.1.0

Since Sep 9Pushed 4y agoCompare

[ Source](https://github.com/Naxon/nova-field-sortable)[ Packagist](https://packagist.org/packages/naxon/nova-field-sortable)[ RSS](/packages/naxon-nova-field-sortable/feed)WikiDiscussions master Synced yesterday

READMEChangelog (5)Dependencies (2)Versions (7)Used By (0)

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

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

[![Latest Version on Packagist](https://camo.githubusercontent.com/ae278513cb014c14ced8f5d01c2e00caa67e128d22bfa6008f78f742fc9083b5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e61786f6e2f6e6f76612d6669656c642d736f727461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/naxon/nova-field-sortable)[![Total Downloads](https://camo.githubusercontent.com/90eac2b913da5c26113cc7de872d9cd09497f6a4d2bd44c98ea77a1bb0f5f43d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e61786f6e2f6e6f76612d6669656c642d736f727461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/naxon/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).

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

Requrements
-----------

[](#requrements)

- Laravel 5.6+ with Nova.
- [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 naxon/nova-field-sortable
```

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 `Naxon\NovaFieldSortable\Concerns\SortsIndexEntries` trait in your Nova Resource.
3. Add a public static property called `$defaultSortField` to your resource, containing your sorting column (I recomment adding it in your main `app/Nova/Resource.php` file).
4. Add the `Naxon\NovaFieldSortable\Sortable` field to your Nova Resource `fields` method, using a label and your primary key column.

### Example

[](#example)

```
