PHP code example of iamtong / laravel-admin-grid-sortable

1. Go to this page and download the library: Download iamtong/laravel-admin-grid-sortable 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/ */

    

iamtong / laravel-admin-grid-sortable example snippets




use Illuminate\Database\Eloquent\Model;
use Spatie\EloquentSortable\Sortable;
use Spatie\EloquentSortable\SortableTrait;

class MyModel extends Model implements Sortable
{
    use SortableTrait;

    public $sortable = [
        'order_column_name' => 'order_column',
        'sort_when_creating' => true,
    ];
}

$grid = new Grid(new MyModel);

$grid->sortable();
shell
php artisan vendor:publish --provider="iamtong\LaravelAdmin\GridSortable\GridSortableServiceProvider"