raditzfarhan/laravel-sortable

为您的Laravel和Lumen Eloquent模型提供简单的可排序行为。

安装次数: 208

依赖: 0

建议者: 0

安全性: 0

星级: 0

关注者: 1

分支: 0

开放问题: 0

类型:laravel-package

v1.0.0 2020-04-21 14:25 UTC

This package is auto-updated.

Last update: 2024-09-06 04:34:23 UTC


README

License styleci

Laravel Sortable

为您的Laravel和Lumen Eloquent模型提供简单的可排序行为。

安装

通过Composer

$ composer require raditzfarhan/laravel-sortable:^1.0

用法

Sortable特质添加到您的模型中

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use RaditzFarhan\LaravelSortable\Sortable;

class Post extends Model
{
    use Sortable;    

    // The ordering column in your table. Default to `sort_order`.
    // No need to set this if your ordering column name is `sort_order`.
    protected $sortable = 'ordering';
}

致谢

许可证

MIT. 更多信息请参阅许可证文件