kevinruscoe / autosortingmodel
此包已被废弃,不再维护。未建议替代包。
一个非常简单的特性,用于根据查询字符串值自动排序模型。
1.0.1
2017-11-25 16:23 UTC
Requires
- php: ^7.0
- illuminate/database: ~5.5.0
- illuminate/http: ~5.5.0
README
这是一个非常简单的特性,可以为Eloquent模型添加自动排序功能。
用法
导入特性如下
<?php
namespace App;
use KevinRuscoe\AutoSortingModel\Traits\AutoSortingModelTrait as AutoSortable;
class User
{
use AutoSortable;
}
默认情况下,特性将查找 sortColumn
和 sortDirection
查询字符串值以进行排序。如果您发布提供的配置文件,则可以覆盖这些值。
有一个辅助函数 sortLink($modelAttribute)
帮助您构建排序链接。