PHP code example of konsulting / laravel-sorting

1. Go to this page and download the library: Download konsulting/laravel-sorting library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

konsulting / laravel-sorting example snippets

 
protected static $sortableSettings = [
    'sortable' => ['name', 'created_at', 'updated_at'],
    'defaultSort' => '+name',
];

{{ App\Post::sortableLink('name', 'Name') }}

App\Post::sort()->paginate();
// The sort method will extract the sort variable from the request, unless you pass them through (e.g. if you store in the session).