PHP code example of tsfcorp / lister

1. Go to this page and download the library: Download tsfcorp/lister 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/ */

    

tsfcorp / lister example snippets


composer 

php artisan vendor:publish --provider="TsfCorp\Lister\ListerServiceProvider"

$lister = new Lister(request(), DB::connection());

$query_settings = [
    'fields' => "users.*",

    'body' => "FROM users {filters}",

    'filters' => [
        "users.id IN (1,2,3)",
        "users.name LIKE '%{filter_name}%'",
    ],

    'sortables' => [
        'name' => 'asc',
    ],
    
    // optional, you can pass a model reference and the records returned 
    // will be of that type
    
    'model' => User:class,
];

$listing = $lister->make($query_settings)->get();

if($redirect_url = $lister->getRedirectUrl()) return redirect($redirect_url);