kevinruscoe/autosortingmodel

This package is abandoned and no longer maintained. No replacement package was suggested.

A very simple trait to auto-sort models based on querystring values.

Installs: 17

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/kevinruscoe/autosortingmodel

1.0.1 2017-11-25 16:23 UTC

This package is not auto-updated.

Last update: 2020-01-22 02:14:59 UTC


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).