PHPackages                             flyhjaelp/laravel-eloquent-orderable - 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. flyhjaelp/laravel-eloquent-orderable

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

flyhjaelp/laravel-eloquent-orderable
====================================

Make your Eloquent models orderable by using the orderable trait on them. Which automatically updates the order of all other models within it's group when the order of a current model is updated or a new model insereted or deleted.

v1.2.0(7y ago)145.2k↓37.5%[4 PRs](https://github.com/Flyhjaelp/laravel-eloquent-orderable/pulls)MITPHP

Since Apr 12Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Flyhjaelp/laravel-eloquent-orderable)[ Packagist](https://packagist.org/packages/flyhjaelp/laravel-eloquent-orderable)[ RSS](/packages/flyhjaelp-laravel-eloquent-orderable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (8)Used By (0)

Laravel Eloquent Orderable
==========================

[](#laravel-eloquent-orderable)

Laravel Eloquent Orderable is a package that helps you make your eloquent models orderable, either within a group our within all other models of the same class.

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

[](#installation)

Install via composer

```
composer require flyhjaelp/laravel-eloquent-orderable
```

Database setup
--------------

[](#database-setup)

If you want to use the orderable functionality on a model it has to have a database column it can be ordered by. By default the package will look for a column named "order", but this can be overwritten. The order column should be an unsigned integer that's nullable. Example:

```
Schema::create('orderable_test_models', function (Blueprint $table) {
  $table->unsignedInteger('order')->nullable();
});
```

Default Usage
-------------

[](#default-usage)

```
