deeplace/rankable

There is no license information available for the latest version (dev-master) of this package.

Provides useful methods to make an eloquent collection rankable

Maintainers

Package info

github.com/Deeplace/rankable

pkg:composer/deeplace/rankable

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-master 2026-03-30 11:29 UTC

This package is not auto-updated.

Last update: 2026-03-30 14:58:26 UTC


README

add in composer

    "repositories": [
        {
            "type": "vcs",
            "url": "git@gitlab.top.md:terranet/rankable.git"
        }
    ],
    "require": {
        "terranet/rankable": "dev-master"
    }
composer update

Usage example

class Program extends Repository implements Translatable, Rankable
{
    use HasRankableField;

    // optional
    protected $rankableColumn = 'rank';

    protected $rankableIncrementValue = 2;

    protected $rankableGroupByColumn = 'member_id';
}

now Program::all() will contain orderBy('rank', 'asc') statement

to disable default orderBy statement use:

Program::unRanked()

to sync rankings call:

$model = new Program;
$model->syncRanking([
    1 => 3,
    2 => 2,
    3 => 1
]);

where key => id, value => rank