PHPackages                             maize-tech/laravel-nova-eloquent-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. [Database &amp; ORM](/categories/database)
4. /
5. maize-tech/laravel-nova-eloquent-sortable

ActiveLibrary[Database &amp; ORM](/categories/database)

maize-tech/laravel-nova-eloquent-sortable
=========================================

Laravel Nova Eloquent Sortable

3.0.1(2y ago)92.2k3[4 PRs](https://github.com/maize-tech/laravel-nova-eloquent-sortable/pulls)MITPHPPHP ^8.0CI passing

Since Oct 10Pushed 1mo ago4 watchersCompare

[ Source](https://github.com/maize-tech/laravel-nova-eloquent-sortable)[ Packagist](https://packagist.org/packages/maize-tech/laravel-nova-eloquent-sortable)[ Docs](https://github.com/maize-tech/laravel-nova-eloquent-sortable)[ GitHub Sponsors](https://github.com/maize-tech)[ RSS](/packages/maize-tech-laravel-nova-eloquent-sortable/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (14)Versions (10)Used By (0)

Laravel Nova Eloquent Sortable
==============================

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

[![Latest Version on Packagist](https://camo.githubusercontent.com/2cddea390a72517c25b017c352802050f1eb55c035d7e42bf056beeab59709e6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d61697a652d746563682f6c61726176656c2d6e6f76612d656c6f7175656e742d736f727461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/maize-tech/laravel-nova-eloquent-sortable)[![GitHub Tests Action Status](https://camo.githubusercontent.com/ebfbe0b388f01cda3660f505dfa539d8b8bb2a896b4d2c741f52dc3c2dc7a297/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d61697a652d746563682f6c61726176656c2d6e6f76612d656c6f7175656e742d736f727461626c652f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/maize-tech/laravel-nova-eloquent-sortable/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/fb565130d9536644375600940f61d8988edd05d7fd9dbbe5bfc964a834365796/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d61697a652d746563682f6c61726176656c2d6e6f76612d656c6f7175656e742d736f727461626c652f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/maize-tech/laravel-nova-eloquent-sortable/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/1ecd1f667fc51a426d8d80474741a720c7d5e67a523dc334941824b338a71ba3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d61697a652d746563682f6c61726176656c2d6e6f76612d656c6f7175656e742d736f727461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/maize-tech/laravel-nova-eloquent-sortable)

Easily add inline sortable actions to any resource in Laravel Nova.

> This package is heavily based on Spatie's [Eloquent Sortable](https://github.com/spatie/eloquent-sortable). Please make sure to read its documentation and installation guide before proceeding!

[![Laravel Nova Eloquent Sortable in action](/art/preview.gif)](/art/preview.gif)

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

[](#installation)

You can install the package via composer:

```
composer require maize-tech/laravel-nova-eloquent-sortable
```

You can publish the config file with:

```
php artisan vendor:publish --tag="nova-eloquent-sortable-config"
```

This is the contents of the published config file:

```
return [

    /*
    |--------------------------------------------------------------------------
    | See sortable action permission
    |--------------------------------------------------------------------------
    |
    | Here you may specify the fully qualified class name of the invokable class
    | used to determine whether a user can see sortable actions or not.
    | If null, all users who have access to Nova will have the permission.
    |
    */

    'can_see_sortable_action' => null,

    /*
    |--------------------------------------------------------------------------
    | Run sortable action permission
    |--------------------------------------------------------------------------
    |
    | Here you may specify the fully qualified class name of the invokable class
    | used to determine whether a user can sort a given model or not.
    | If null, all users who have access to Nova will have the permission.
    |
    */

    'can_run_sortable_action' => null,

];
```

Usage
-----

[](#usage)

To use the package, add the `Maize\NovaEloquentSortable\HasEloquentSortable` trait to the nova resource where you want to have marks:

```
use Laravel\Nova\Resource;
use Maize\NovaEloquentSortable\HasEloquentSortable;

class MyResource extends Resource {
    use HasEloquentSortable;
}
```

Once done, all you have to do is include all the actions you need for the given resource:

```
use Maize\NovaEloquentSortable\Actions\MoveOrderDownAction;
use Maize\NovaEloquentSortable\Actions\MoveOrderUpAction;
use Maize\NovaEloquentSortable\Actions\MoveToEndAction;
use Maize\NovaEloquentSortable\Actions\MoveToStartAction;

public function actions(NovaRequest $request)
{
    return [
        MoveOrderDownAction::make(),
        MoveToEndAction::make(),
        MoveOrderUpAction::make(),
        MoveToStartAction::make(),
    ];
}
```

You can also include the custom OrderColumn field, which allows you to show the order of each entity when indexing them:

```
use Maize\NovaEloquentSortable\Fields\OrderColumn;

public function fields(NovaRequest $request)
{
    return [
        OrderColumn::new('Order', static::class),
    ];
}
```

Available Actions
-----------------

[](#available-actions)

- [`MoveOrderDownAction`](#moveorderdownaction)
- [`MoveToEndAction`](#movetoendaction)
- [`MoveOrderUpAction`](#moveorderupaction)
- [`MoveToStartAction`](#movetostartaction)

### MoveOrderDownAction

[](#moveorderdownaction)

The `MoveOrderDownAction` inline action moves the given model down by a single position.

The action is automatically hidden when the model is already in the last position.

### MoveToEndAction

[](#movetoendaction)

The `MoveToEndAction` inline action moves the given model to the last position.

The action is automatically hidden when the model is already in the last position.

### MoveOrderUpAction

[](#moveorderupaction)

The `MoveOrderUpAction` inline action moves the given model up by a single position.

The action is automatically hidden when the model is already in the first position.

### MoveToStartAction

[](#movetostartaction)

The `MoveToStartAction` inline action moves the given model to the first position.

The action is automatically hidden when the model is already in the first position.

Define a custom visibility
--------------------------

[](#define-a-custom-visibility)

By default, all users who have access to Laravel Nova will be able to see all included sort actions.

If you want to restrict their visibility for some users, you can define a custom `CanSeeSortableAction` invokable class.

Here's an example class checking user's permissions:

```
use Laravel\Nova\Http\Requests\NovaRequest;

class CanSeeSortableAction
{
    public function __invoke(NovaRequest $request): bool
    {
        return $request->user()->can('sort_models');
    }
}
```

Once done, all you have to do is reference your custom class in `can_see_sortable_action` attribute under `config/nova-eloquent-sortable.php`:

```
'can_see_sortable_action' => \Path\To\CanSeeSortableAction::class,
```

Define a custom run permission
------------------------------

[](#define-a-custom-run-permission)

By default, all users who have access to Laravel Nova will be able to run all included sort actions.

If you want to restrict the permission for some users, you can define a custom `CanRunSortableAction` invokable class.

Here's an example class checking user's permissions:

```
use Illuminate\Database\Eloquent\Model;
use Laravel\Nova\Http\Requests\NovaRequest;

class CanRunSortableAction
{
    public function __invoke(NovaRequest $request, Model $model): bool
    {
        return $request->user()->can('sort_model', $model);
    }
}
```

Once done, all you have to do is reference your custom class in `can_run_sortable_action` attribute under `config/nova-eloquent-sortable.php`:

```
'can_run_sortable_action' => \Path\To\CanRunSortableAction::class,
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/maize-tech/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](https://github.com/maize-tech/.github/security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Enrico De Lazzari](https://github.com/enricodelazzari)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance60

Regular maintenance activity

Popularity25

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~97 days

Total

5

Last Release

921d ago

Major Versions

0.1.0 → 1.0.02022-10-20

1.0.0 → 2.0.02023-02-13

2.0.0 → 3.0.02023-11-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/848d3feb1799fbdb3ff475a4398017f9bc2b94c5cba4dd69d414af62a856fcc4?d=identicon)[maize-tech](/maintainers/maize-tech)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (22 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (16 commits)")[![riccardodallavia](https://avatars.githubusercontent.com/u/1372062?v=4)](https://github.com/riccardodallavia "riccardodallavia (5 commits)")[![enricodelazzari](https://avatars.githubusercontent.com/u/10452445?v=4)](https://github.com/enricodelazzari "enricodelazzari (3 commits)")[![frestifo](https://avatars.githubusercontent.com/u/138138732?v=4)](https://github.com/frestifo "frestifo (1 commits)")

---

Tags

fieldlaravelnovasortablesortinglaraveleloquentsortablenovamaize-tech

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/maize-tech-laravel-nova-eloquent-sortable/health.svg)

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

###  Alternatives

[spatie/eloquent-sortable

Sortable behaviour for eloquent models

1.5k22.9M268](/packages/spatie-eloquent-sortable)[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[lacodix/laravel-model-filter

A Laravel package to filter, search and sort models with ease while fetching from database.

17649.9k](/packages/lacodix-laravel-model-filter)[cybercog/laravel-nova-ban

A Laravel Nova banning functionality for your application.

40199.8k](/packages/cybercog-laravel-nova-ban)[indexzer0/eloquent-filtering

Powerful eloquent filtering

22425.9k3](/packages/indexzer0-eloquent-filtering)[giacomomasseron/laravel-models-generator

Generate Laravel models from an existing database

484.2k](/packages/giacomomasseron-laravel-models-generator)

PHPackages © 2026

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