kevinruscoe / autosortingmodeltrait
A very simple trait to auto-sort models based on querystring values.
Installs: 14
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/kevinruscoe/autosortingmodeltrait
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)
.