raditzfarhan / laravel-sortable
为您的Laravel和Lumen Eloquent模型提供简单的可排序行为。
v1.0.0
2020-04-21 14:25 UTC
This package is auto-updated.
Last update: 2024-09-06 04:34:23 UTC
README
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. 更多信息请参阅许可证文件。