Skip to content

Deeplace/rankable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages