Download the PHP package hichxm/laravel-sortable without Composer
On this page you can find all versions of the php package hichxm/laravel-sortable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hichxm/laravel-sortable
More information about hichxm/laravel-sortable
Files in hichxm/laravel-sortable
Package laravel-sortable
Short Description Laravel sortable packages for Laravel ecosystem by Hichxm
License MIT
Homepage https://github.com/hichxm/laravel-sortable
Informations about the package laravel-sortable
Laravel Sortable
Laravel Sortable is a trait that adds sortable behaviour to an Eloquent model.
Supported Laravel Versions
Laravel Version | 11 | 10 | 9 |
---|---|---|---|
PHP 8.1 | ❌ | ✅ | ✅ |
PHP 8.2 | ✅ | ✅ | ✅ |
PHP 8.3 | ✅ | ✅ | ✅ |
Installation
You can install the package via composer:
Usage
Create a new migration to add a new column to your table:
Add the Hichxm\LaravelSortable\HasSortableColumn
trait to your model:
By default, the trait will look for a column named order
,
but you can customize this by setting the $sortableColumn
property on your model:
You can now use the following methods on your model to manage order:
You can also use the following methods to get query ordered results:
Testing
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-sortable with dependencies
illuminate/database Version ^9.0|^10.0|^11.0
nesbot/carbon Version ^2.63|^3.0
spatie/laravel-package-tools Version ^1.16.4