PHPackages                             neurony/laravel-sort - 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. neurony/laravel-sort

Abandoned → [varbox/varbox](/?search=varbox%2Fvarbox)ArchivedLibrary[Database &amp; ORM](/categories/database)

neurony/laravel-sort
====================

Sort Eloquent model records by their attributes or relationships

3.0.0(6y ago)641153MITPHPPHP ^7.2

Since Jan 23Pushed 6y ago2 watchersCompare

[ Source](https://github.com/Neurony/laravel-sort)[ Packagist](https://packagist.org/packages/neurony/laravel-sort)[ RSS](/packages/neurony-laravel-sort/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (5)Versions (6)Used By (0)

Sort Eloquent model records by their attributes or relationships
================================================================

[](#sort-eloquent-model-records-by-their-attributes-or-relationships)

[![Build Status](https://camo.githubusercontent.com/c76a232955f104ff09586431ba9618a8da073e8ec70f8b5492db5d7c228787b9/68747470733a2f2f7472617669732d63692e6f72672f4e6575726f6e792f6c61726176656c2d736f72742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Neurony/laravel-sort)[![StyleCI](https://camo.githubusercontent.com/5bfe23f7d4e011727699533fdb17ba92f226e91e0e3d79e07f16e92db88817a7/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3136373236323039352f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/167262095)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/7676b231cfa63afdc1c79482532622b13e4ecff24a8bf02e7a81cee614ba54f0/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4e6575726f6e792f6c61726176656c2d736f72742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Neurony/laravel-sort/?branch=master)

- [Overview](#overview)
- [Installation](#installation)
- [Usage](#usage)
- [Extra](#extra)

Overview
========

[](#overview)

This package allows you to sort Eloquent model records by their attributes, or via their relationships.

Relationship types that can be sorted by: `hasOne`, `belongsTo`

Installation
============

[](#installation)

Install the package via Composer:

```
composer require neurony/laravel-sort

```

Usage
=====

[](#usage)

### Step 1

[](#step-1)

Your Eloquent models should use the `Neurony\Sort\Traits\IsSortable` trait.

```
