PHPackages                             joligoms/nova-sort-relations - 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. joligoms/nova-sort-relations

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

joligoms/nova-sort-relations
============================

This package improves support for sorting relations in Laravel Nova.

1.0.0(4y ago)0161MITPHPPHP &gt;=7.1.0

Since Oct 24Pushed 4y agoCompare

[ Source](https://github.com/joligoms/nova-sort-relations)[ Packagist](https://packagist.org/packages/joligoms/nova-sort-relations)[ RSS](/packages/joligoms-nova-sort-relations/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependenciesVersions (5)Used By (0)

Joligoms/nova-sort-relations
----------------------------

[](#joligomsnova-sort-relations)

This package improves support for sorting relations in Laravel Nova.

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

[](#installation)

Install via composer

```
$ composer require joligoms/nova-sort-relations
```

Usage
-----

[](#usage)

Include `Joligoms\SortRelations\SortRelations` trait to your resource class or in `App\Nova\Resource` if you want all resources to have this feature. Define sortable columns in `$sortRelations` array.

```
...
use Joligoms\SortRelations\SortRelations;
...

class Post extends Resource
{
    public static $sortRelations = [
        'user' => /*
                      The attribute specified in the field, for example:
                                              ˅˅˅˅
                      Text::make(__('User'), 'user', function () {
                          return $this->model()->user->username;
                      });
                   */
            [
                'relation' => 'user', // The relation from the current resource's model.
                'title' => 'username', // (Optional) The relation's column that should be selected in the indexQuery. If not specified, it will use the resource's title property.
                'columns' => 'username' // The columns that should be ordered in the query. It can be a string or array.
            ],
        'company' => [
            'relation' => 'user.company', // Dot notation can be specified when the relation goes through multiple relations.
            'columns' => 'name'
        ]
    ];

    public static function indexQuery(NovaRequest $request, $query)
    {
        // You can modify your base query here, only if necessary. Sort Relations will be applied automatically...
        return $query;
    }
}
```

Security
--------

[](#security)

If you discover any security-related issues, please email the author instead of using the issue tracker.

Credits
-------

[](#credits)

- [Jani Cerar](https://github.com/janicerar)
- [Adam Anderly](https://github.com/anderly)
- [LifeOnScreen](https://github.com/LifeOnScreen)
- [Newton Evangelista da Gama Junior](https://github.com/newtongamajr)

License
-------

[](#license)

MIT license. Please see the [license file](docs/license.md) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 58.3% 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 ~560 days

Total

3

Last Release

1638d ago

Major Versions

v0.0.2 → 1.0.02021-11-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/241f36c84b7654db960e1bad9decfbe4b580f87d85d7258798aed5d8608b6951?d=identicon)[joligoms](/maintainers/joligoms)

---

Top Contributors

[![newtongamajr](https://avatars.githubusercontent.com/u/8673343?v=4)](https://github.com/newtongamajr "newtongamajr (7 commits)")[![anderly](https://avatars.githubusercontent.com/u/573151?v=4)](https://github.com/anderly "anderly (3 commits)")[![janicerar](https://avatars.githubusercontent.com/u/29040621?v=4)](https://github.com/janicerar "janicerar (2 commits)")

---

Tags

laravelsortrelationsnova

### Embed Badge

![Health badge](/badges/joligoms-nova-sort-relations/health.svg)

```
[![Health](https://phpackages.com/badges/joligoms-nova-sort-relations/health.svg)](https://phpackages.com/packages/joligoms-nova-sort-relations)
```

###  Alternatives

[optimistdigital/nova-multiselect-field

A multiple select field for Laravel Nova.

3403.5M7](/packages/optimistdigital-nova-multiselect-field)[lifeonscreen/nova-sort-relations

This package improves support for sorting relations in Laravel Nova.

2081.9k](/packages/lifeonscreen-nova-sort-relations)[genealabs/laravel-overridable-model

Provide a uniform method of allowing models to be overridden in Laravel.

92398.0k2](/packages/genealabs-laravel-overridable-model)[inspheric/nova-defaultable

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

51174.8k1](/packages/inspheric-nova-defaultable)[murdercode/nova4-tinymce-editor

Boost your Laravel Nova with the TinyMCE editor.

17165.2k](/packages/murdercode-nova4-tinymce-editor)[yieldstudio/nova-google-autocomplete

A Laravel Nova Google autocomplete field.

12218.4k](/packages/yieldstudio-nova-google-autocomplete)

PHPackages © 2026

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