PHPackages                             samrat131/column-sortable - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. samrat131/column-sortable

ActivePackage[Utility &amp; Helpers](/categories/utility)

samrat131/column-sortable
=========================

Sort laravel model view list by database column or field wise

v1.4(5y ago)221MITPHPPHP &gt;=5.6

Since Aug 24Pushed 5y ago1 watchersCompare

[ Source](https://github.com/samrat131/column-sortable)[ Packagist](https://packagist.org/packages/samrat131/column-sortable)[ RSS](/packages/samrat131-column-sortable/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

Laravel Column Sortable
=======================

[](#laravel-column-sortable)

Sort laravel model view list by database column or field wise

Installation
------------

[](#installation)

To use this package in your project, please use Composer to add the package to your laravel applications

```
composer require samrat131/column-sortable

```

Edit `config/app.php` file and add following lines (only for laravel version below 5.5)

```
'providers' => [
	...
	Samrat131\ColumnSortable\ColumnSortableServiceProvider::class,
]

```

Usage
-----

[](#usage)

### Model

[](#model)

Edit any laravel model .php file, add `SortableTrait` shipped with this package, add `protected $columnToSort` variable and list database field/cloumn that needs to be sortable.

```
