deeplace/rankable
Composer 安装命令:
composer require deeplace/rankable
包简介
Provides useful methods to make an eloquent collection rankable
README 文档
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
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2026-03-30