PHP code example of thoss / laravel-gap-sort

1. Go to this page and download the library: Download thoss/laravel-gap-sort 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/ */

    

thoss / laravel-gap-sort example snippets


return [
    /*
    * The name of the column that will be used to sort models.
    */
    'order_column' => 'order',

    /*
    * The gap between the sorted items
    */
    'order_gap' => 1000,

    /*
    * Indicates wheter the "/sort" route will be automaticaly added when you use the route ::register method
    */
    'resource_registrar_with_sort' => false,
];


dispatch(new SortModel(modelString: YourModel::class, initTable:true));

Route::resource('salutations', 'SalutationsController', ['with' => ['sort']]);

use Thoss\GapSort\Requests\SortRequest;
use Thoss\GapSort\SortModel;

public function sort(SortRequest $request)
{
    return $this->dispatchSync(new SortModel(MyModel::class));
}