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

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

    

laravel-admin-ext / 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="Encore\Admin\GridSortable\GridSortableServiceProvider"