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

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

cierrateam/nova-sortable
========================

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2.1.7(5y ago)027MITVuePHP &gt;=7.3.0

Since Nov 1Pushed 5y agoCompare

[ Source](https://github.com/cierrateam/nova-sortable)[ Packagist](https://packagist.org/packages/cierrateam/nova-sortable)[ GitHub Sponsors](https://github.com/optimistdigital)[ RSS](/packages/cierrateam-nova-sortable/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (1)Dependencies (3)Versions (41)Used By (0)

Nova Sortable
=============

[](#nova-sortable)

This package is forked from [optimistdigital/nova-sortable](https://github.com/optimistdigital/nova-sortable). The difference is that the edit buttons are on the left side instead of the right side.

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

[](#requirements)

- `php: >=7.3`
- `laravel/nova: ^3.0`

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

[](#installation)

Install the package in a Laravel Nova project via Composer:

```
# Install package
composer require cierrateam/nova-sortable
```

Usage
-----

[](#usage)

### Create migration

[](#create-migration)

Add an order field to the model using Laravel migrations:

```
// Add order column to the model
Schema::table('some_model', function (Blueprint $table) {
  $table->integer('sort_order');
});

// Set default sort order (just copy ID to sort order)
DB::statement('UPDATE some_model SET sort_order = id');
```

### Implement eloquent-sortable

[](#implement-eloquent-sortable)

Implement the Spatie's `eloquent-sortable` interface and apply the trait:

```
use Spatie\EloquentSortable\Sortable;
use Spatie\EloquentSortable\SortableTrait;

class SomeModel extends Eloquent implements Sortable
{
  use SortableTrait;

  public $sortable = [
    'order_column_name' => 'sort_order',
    'sort_when_creating' => true,
  ];

  ...
}
```

When the model does not have a sortable configuration, the default eloquent-sortable configuration will be used.

### Apply HasSortableRows to Nova resource

[](#apply-hassortablerows-to-nova-resource)

Apply `HasSortableRows` trait from this package on the Resource:

```
use Cierrateam\NovaSortable\Traits\HasSortableRows;

class MyResource extends Resource
{
  use HasSortableRows;

  ...
}
```

NB! This overrides the `indexQuery()` method.

### Disallowing sorting on a per-request/resource basis

[](#disallowing-sorting-on-a-per-requestresource-basis)

You can disable sorting on a per-request or per-resource basis by overriding the `canSort()` on the Resource method like so:

```
public static function canSort(NovaRequest $request, $resource)
{
  // Do whatever here, ie:
  // return user()->isAdmin();
  // return $resource->id !== 5;
  return true;
}
```

Sorting on HasMany relationship
-------------------------------

[](#sorting-on-hasmany-relationship)

**NB!** The resource can only be sorted on **either** the Index view **or** the HasMany list view, but not both!

Sorting on HasMany is simple. Add `'sort_on_has_many' => true` to the `$sortable` array on the model. Like so:

```
public $sortable = [
  'order_column_name' => 'sort_order',
  'sort_when_creating' => true,
  'sort_on_has_many' => true,
];
```

The sort on has many configuration can be apply in a per model basis or it can be added in the eloquent-sortable configuration for all the models.

```
return [

    // Spatie sortable configuration

    /**
     * Add sort on has many in all the models.
     **/
    'sort_on_has_many' => true,
];
```

Sorting on ManyToMany relationships
-----------------------------------

[](#sorting-on-manytomany-relationships)

Sorting on BelongsToMany and MorphToMany relationships is available, but requires special steps.

See the documentation here: [Sorting ManyToMany relationships (w/ pivot table)](docs/sorting/many-to-many.md).

Localization
------------

[](#localization)

The translation file(s) can be published by using the following publish command:

```
php artisan vendor:publish --provider="Cierrateam\NovaSortable\ToolServiceProvider" --tag="translations"
```

You can add your translations to `resources/lang/vendor/nova-sortable/` by creating a new translations file with the locale name (ie `et.json`) and copying the JSON from the existing `en.json`.

Credits
-------

[](#credits)

- [Tarvo Reinpalu](https://github.com/Tarpsvo)

License
-------

[](#license)

Nova Sortable is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 89.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~12 days

Total

40

Last Release

1915d ago

Major Versions

1.6.2 → 2.0.02020-12-04

PHP version history (2 changes)1.0.0PHP &gt;=7.1.0

2.0.0PHP &gt;=7.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/a768dba92b1e591d0d2da7299c532d533494cc3ac585d051c08e5f46be5ade31?d=identicon)[cierrateam](/maintainers/cierrateam)

![](https://www.gravatar.com/avatar/70e00cab9d8cf8c28162c676e1a54c6d09a71b65593dc38a67740de70a88411b?d=identicon)[lukas-cierra](/maintainers/lukas-cierra)

---

Top Contributors

[![Tarpsvo](https://avatars.githubusercontent.com/u/2018660?v=4)](https://github.com/Tarpsvo "Tarpsvo (198 commits)")[![lukas-cierra](https://avatars.githubusercontent.com/u/69144406?v=4)](https://github.com/lukas-cierra "lukas-cierra (4 commits)")[![pzmarzly](https://avatars.githubusercontent.com/u/8074163?v=4)](https://github.com/pzmarzly "pzmarzly (3 commits)")[![Jnewbon](https://avatars.githubusercontent.com/u/48688400?v=4)](https://github.com/Jnewbon "Jnewbon (2 commits)")[![fkraefft](https://avatars.githubusercontent.com/u/25204406?v=4)](https://github.com/fkraefft "fkraefft (2 commits)")[![mynetx](https://avatars.githubusercontent.com/u/6348321?v=4)](https://github.com/mynetx "mynetx (1 commits)")[![Naoray](https://avatars.githubusercontent.com/u/10154100?v=4)](https://github.com/Naoray "Naoray (1 commits)")[![newtongamajr](https://avatars.githubusercontent.com/u/8673343?v=4)](https://github.com/newtongamajr "newtongamajr (1 commits)")[![shaffe-fr](https://avatars.githubusercontent.com/u/3834222?v=4)](https://github.com/shaffe-fr "shaffe-fr (1 commits)")[![stevelacey](https://avatars.githubusercontent.com/u/289531?v=4)](https://github.com/stevelacey "stevelacey (1 commits)")[![TheSETJ](https://avatars.githubusercontent.com/u/10893088?v=4)](https://github.com/TheSETJ "TheSETJ (1 commits)")[![eduardoesternon](https://avatars.githubusercontent.com/u/50344223?v=4)](https://github.com/eduardoesternon "eduardoesternon (1 commits)")[![toonvandenbos](https://avatars.githubusercontent.com/u/5635557?v=4)](https://github.com/toonvandenbos "toonvandenbos (1 commits)")[![everestmx](https://avatars.githubusercontent.com/u/5403326?v=4)](https://github.com/everestmx "everestmx (1 commits)")[![FaridAghili](https://avatars.githubusercontent.com/u/8607021?v=4)](https://github.com/FaridAghili "FaridAghili (1 commits)")[![gerardnll](https://avatars.githubusercontent.com/u/2018022?v=4)](https://github.com/gerardnll "gerardnll (1 commits)")[![marispro](https://avatars.githubusercontent.com/u/5610414?v=4)](https://github.com/marispro "marispro (1 commits)")

---

Tags

laravelnovaoptimistdigitaleloquent-sortable

### Embed Badge

![Health badge](/badges/cierrateam-nova-sortable/health.svg)

```
[![Health](https://phpackages.com/badges/cierrateam-nova-sortable/health.svg)](https://phpackages.com/packages/cierrateam-nova-sortable)
```

###  Alternatives

[optimistdigital/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2872.1M6](/packages/optimistdigital-nova-sortable)[outl1ne/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2861.8M9](/packages/outl1ne-nova-sortable)[naxon/nova-field-sortable

A Laravel Nova field.

59271.0k](/packages/naxon-nova-field-sortable)[michielkempen/nova-order-field

A Laravel Nova field.

59232.6k2](/packages/michielkempen-nova-order-field)[sbine/route-viewer

A Laravel Nova tool to view your registered routes.

57215.9k](/packages/sbine-route-viewer)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

14720.0k](/packages/markwalet-nova-modal-response)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
