2017 © Pedro Peláez
 

libary laraveldynamicsort

Lets you sort your Models dynamically by querystring

image

marmarait/laraveldynamicsort

Lets you sort your Models dynamically by querystring

  • Wednesday, December 20, 2017
  • by romeosemper
  • Repository
  • 1 Watchers
  • 1 Stars
  • 89 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 11 % Grown

The README.md

Laravel 5.5 Dynamic Sort

Overview

Simply sort your Models by using querystring parameters., (*1)

Install

composer require marmarait/laraveldynamicsort, (*2)

Optionally you can also add the jQuery Plugin provided to do the frontend part.

php artisan vendor:publish --provider=MarmaraIT\LaravelDynamicSort\DynamicallySortableProvider, (*3)

Somewhere in the , (*4)

part of your layout add

@include('laraveldynamicsort::short_sort'), (*5)

  • If you are using gulp simply add "dynamicallySortable.js" to your gulpfile.js
  • If you are using laravel-mix add "resources/assets/js/dynamicallySortable.js" to your webpack.mix

Usage

Backend:, (*6)

  • add the Trait "DynamicallySortable" to your model
  • use the scope "ordered" on the model to sort it by querystring:
  • add sort=COLUMNAME&dir=[[asc/desc]] to your query string to sort the active model

To use the jquery-plugin, give the table header(th) elements the attribute data-sort="COLUMNAME" and call the plugin $('.selector').dynamicallySortable() (selector = the th elements; f.e. $('th[data-sort]') ), (*7)

Defaults

Set the defaultDir property on your model to define the default order direction (asc/desc)
Set the defaultSort property to set the default sorting column, (*8)

The Versions

20/12 2017

dev-master

9999999-dev

Lets you sort your Models dynamically by querystring

  Sources   Download

MIT

by Romeo Semper

20/12 2017

1.0.0

1.0.0.0

Lets you sort your Models dynamically by querystring

  Sources   Download

MIT

by Romeo Semper