james.xue/laravel-admin-sortable
最新稳定版本:1.0
Composer 安装命令:
composer require james.xue/laravel-admin-sortable
包简介
Sortable behaviour for eloquent models
README 文档
README
这个扩展包用来 sortable
Screenshot
Installation First, install dependencies:
composer require james.xue/laravel-admin-sortable
Second, Modified model
use James\Sortable\SortableTrait;
use James\Sortable\Sortable;
class Test extends Model implements Sortable
{
use SortableTrait;
public $sortable = [
'sort_field' => 'status', // 排序字段
'sort_when_creating' => true, // 新增是否自增,默认自增
];
}
Configuration In the extensions section of the config/admin.php file, add some configuration that belongs to this extension.
'extensions' => [
'sortableColumn' => [
// set to false if you want to disable this extension
'enable' => true,
]
]
User
$grid = new Grid(new Test);
$grid->model()->orderBy('status', 'asc'); // 这个很重要,否则页面显示顺序不正确
$grid->status('状态')->sortableColumn('\App\Test'); // sortableColumn 里面必须填入当前模型的 namespace ,
OR
$grid->status('状态')->sortableColumn(Test::class);
统计信息
- 总下载量: 7.78k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-06-04
