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

ActiveLibrary

pkaratanev/nova-sortable
========================

A Laravel Nova tool.

2.0.0(5y ago)02.1kMITVuePHP &gt;=7.1.0

Since Apr 21Pushed 5y agoCompare

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

READMEChangelogDependenciesVersions (9)Used By (0)

Check fork source for a working documentation
=============================================

[](#check-fork-source-for-a-working-documentation)

Nova sortable
=============

[](#nova-sortable)

> Adds sorting functionality to Laravel Nova's index resource

Installing
----------

[](#installing)

```
composer require ofcold/nova-sortable
```

Using
-----

[](#using)

- Add a sort field to your database migrations file.

***Example***

```
$table->unsignedInteger('sort_order')->nullable();
```

- Trait entry

```
use Ofcold\NovaSortable\SortableTrait;

class Entry extends Model
{
	use SortableTrait;
}
```

- Specify whether the resource needs to be sorted.

```
class Example extends Resource
{
	/**
	 * Build an "index" query for the given resource.
	 *
	 * @param  \Laravel\Nova\Http\Requests\NovaRequest  $request
	 * @param  \Illuminate\Database\Eloquent\Builder  $query
	 *
	 * @return \Illuminate\Database\Eloquent\Builder
	 */
	public static function indexQuery(NovaRequest $request, $query)
	{
		$query->when(empty($request->get('orderBy')), function ($q) {
			$q->getQuery()->orders = [];
			return $q->orderBy(static::$model::orderColumnName());
		});

		return $query;
	}

	/**
	 * Prepare the resource for JSON serialization.
	 *
	 * @param  \Laravel\Nova\Http\Requests\NovaRequest  $request
	 * @param  \Illuminate\Support\Collection  $fields
	 *
	 * @return array
	 */
	public function serializeForIndex(NovaRequest $request, $fields = null)
	{
		return array_merge(parent::serializeForIndex($request, $fields), [
			'sortable'	=> true
		]);
	}
}
```

Change sort field name
----------------------

[](#change-sort-field-name)

> You only need to change the method 'orderColumnName' in your entry.

```
/*
 * Determine the column name of the order column.
 */
public static function orderColumnName(): string
{
	return 'your sort order column name';
}
```

Demos
-----

[](#demos)

[![](https://github.com/ofcold/nova-sortable/raw/master/demos.gif?sanitize=true)](https://github.com/ofcold/nova-sortable/raw/master/demos.gif?sanitize=true)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 73.7% 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 ~91 days

Recently: every ~159 days

Total

8

Last Release

1937d ago

Major Versions

1.0.6 → 2.0.02021-01-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/3da9d43a7d50d911ccd85c13570c97d9f4591c9ce1521738de5119e27a775a23?d=identicon)[pkaratanev](/maintainers/pkaratanev)

---

Top Contributors

[![lilianjin](https://avatars.githubusercontent.com/u/21023027?v=4)](https://github.com/lilianjin "lilianjin (14 commits)")[![LorenzoSapora](https://avatars.githubusercontent.com/u/25519274?v=4)](https://github.com/LorenzoSapora "LorenzoSapora (1 commits)")[![pkaratanev](https://avatars.githubusercontent.com/u/47246453?v=4)](https://github.com/pkaratanev "pkaratanev (1 commits)")[![ralphschindler](https://avatars.githubusercontent.com/u/76674?v=4)](https://github.com/ralphschindler "ralphschindler (1 commits)")[![shaffe-fr](https://avatars.githubusercontent.com/u/3834222?v=4)](https://github.com/shaffe-fr "shaffe-fr (1 commits)")[![tsteiman-switchbox](https://avatars.githubusercontent.com/u/265055647?v=4)](https://github.com/tsteiman-switchbox "tsteiman-switchbox (1 commits)")

---

Tags

laravelnova

### Embed Badge

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

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

###  Alternatives

[optimistdigital/nova-multiselect-field

A multiple select field for Laravel Nova.

3403.5M7](/packages/optimistdigital-nova-multiselect-field)[coreproc/nova-notification-feed

A Laravel Nova package that adds a notification feed in your Nova app.

10149.1k](/packages/coreproc-nova-notification-feed)[inspheric/nova-defaultable

Default values for Nova fields when creating resources and running resource actions.

51174.8k1](/packages/inspheric-nova-defaultable)[cybercog/laravel-nova-ban

A Laravel Nova banning functionality for your application.

40199.8k](/packages/cybercog-laravel-nova-ban)[insenseanalytics/nova-server-monitor

A Laravel Nova tool for Spatie's Server Monitor library.

6546.9k](/packages/insenseanalytics-nova-server-monitor)[datomatic/nova-detached-actions

A Laravel Nova tool to allow for placing actions in the Nova toolbar detached from the checkbox selection mechanism.

11229.2k](/packages/datomatic-nova-detached-actions)

PHPackages © 2026

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