kevinruscoe / autosortingmodeltrait
This package is abandoned and no longer maintained.
The author suggests using the kevinruscoe/autosortingmodel package instead.
A very simple trait to auto-sort models based on querystring values.
1.0.1
2017-11-25 16:23 UTC
Requires
- php: ^7.0
- illuminate/database: ~5.5.0
- illuminate/http: ~5.5.0
README
This is a very simple trait that add auto-sorting to Eloquent models.
Usage
Import the trait like:
<?php
namespace App;
use KevinRuscoe\AutoSortingModel\Traits\AutoSortingModelTrait as AutoSortable;
class User
{
use AutoSortable;
}
By default the trait will look for the sortColumn
and sortDirection
querystring values to do the
sorting. If you publish the provided config file you can overwrite these.
There's a helper function to help you craft sorting links using sortLink($modelAttribute)
.