PHPackages                             erikgall/listify - 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. erikgall/listify

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

erikgall/listify
================

Turn any Eloquent model into a list! http://erikgall.github.io/listify

3.0.0(5y ago)214.5k↓34.8%MITPHPPHP ^7.3|^8.0

Since Dec 21Pushed 5y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (6)Versions (17)Used By (0)

Listify
=======

[](#listify)

[![Latest Stable Version](https://camo.githubusercontent.com/f463daff03197e729cc23d640174afdb9a4138fb918a5e477ac51ab475423d82/68747470733a2f2f706f7365722e707567782e6f72672f6572696b67616c6c2f6c6973746966792f76)](//packagist.org/packages/erikgall/listify)[![Total Downloads](https://camo.githubusercontent.com/26b7fd1d7285ad48f272248cabae3633c540cd5c7608d762385fceed19a5fae0/68747470733a2f2f706f7365722e707567782e6f72672f6572696b67616c6c2f6c6973746966792f646f776e6c6f616473)](//packagist.org/packages/erikgall/listify)[![Latest Unstable Version](https://camo.githubusercontent.com/55082bd727b34ca7a5b3c02c61386100c16bf3a7aa84854ef13d287e66670256/68747470733a2f2f706f7365722e707567782e6f72672f6572696b67616c6c2f6c6973746966792f762f756e737461626c65)](//packagist.org/packages/erikgall/listify)[![License](https://camo.githubusercontent.com/2cf38394b2d4a6ddd2e10340b585ec663a5e6426b2591cf6a2895c23c6d86624/68747470733a2f2f706f7365722e707567782e6f72672f6572696b67616c6c2f6c6973746966792f6c6963656e7365)](//packagist.org/packages/erikgall/listify)

Turn any Eloquent model into a list!

Description
-----------

[](#description)

This project was originally created by [Travis Vignon](https://github.com/lookitsatravis/listify) but is no longer maintained and only supported Laravel 5. This fork of the project provides support for Laravel 7 &amp; 8 applications and will be updated as new Laravel versions are released. Please feel free to send in contributions and help keep this package up to date!

Listify provides the capabilities for sorting and reordering a number of objects in a list. The class that has this specified needs to have a `position` column defined as an integer on the mapped database table. Listify is an Eloquent port of the highly useful Ruby gem `acts_as_list` ([https://github.com/swanandp/acts\_as\_list](https://github.com/swanandp/acts_as_list)).

- [Description](#description)
- [Requirements](#requirements)
- [Installation](#installation)
- [Quickstart](#quickstart)
- [Overview](#overview)
    - [Instance Methods Added To Eloquent Models](#instance-methods-added-to-eloquent-models)
- [Configuration](#configuration)
    - [String](#string)
    - [Illuminate\\Database\\Eloquent\\Relations\\BelongsTo](#illuminatedatabaseeloquentrelationsbelongsto)
    - [Illuminate\\Database\\Query\\Builder](#illuminatedatabasequerybuilder)
    - [Changing the configuration](#changing-the-configuration)
- [Notes](#notes)
- [Future Plans](#future-plans)
- [Contributing to Listify](#contributing-to-listify)
- [Copyright](#copyright)

Requirements
------------

[](#requirements)

- Listify currently requires php &gt;= 7.2.5
- Laravel 7 or Laravel 8

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

[](#installation)

Install Listify into your Laravel 8 application with composer:

```
$ composer require erikgall/listify
```

The Laravel 7 branch can be found here [erikgall/listify:2.x](https://github.com/erikgall/listify/tree/2.x)

To install Listify into your Laravel 7 application with composer:

```
$ composer require erikgall/listify:^2.0
```

Quickstart
----------

[](#quickstart)

First things first, you'll need to add a column to store the position. From the command line, use the migration generator:

```
php artisan listify:attach {table_name} {position_column_name}

php artisan migrate
```

> `{table_name}` is a required argument. `{position_column_name}` is optional and the default value is "position".

Then, in your model:

```
