PHP code example of mikelmi / mks-smart-table

1. Go to this page and download the library: Download mikelmi/mks-smart-table 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/ */

    

mikelmi / mks-smart-table example snippets


        Mikelmi\SmartTable\Providers\SmartTableServiceProvider::class,
    

    //Query Builder
    $source = \App\User::select(['id', 'name', 'email', 'created_at']);
    
    //or Collection
    $source = collect([
        ['id' => '1', 'name' => 'John Smith'],
        ['id' => '2', 'name' => 'Mister X'],
        //...
    ]);
    

    $engine = app(\Mikelmi\SmartTable\SmartTable::class)->make($source);
    
    //optionaly set columns for general search
    $engine->setSearchColumns(['name', 'email'])
    

    $engine->apply();
    
    //optionaly apply advanced method for your source, e.g. default sorting
    $engine->orderBy('created_at', 'desc');
    

    return $engine->response();
    
    
        php artisan vendor:publish --provider="Mikelmi\SmartTable\Providers\SmartTableServiceProvider"