PHP code example of pstldz / dcat-admin-grid-sotrable
1. Go to this page and download the library: Download pstldz/dcat-admin-grid-sotrable 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/ */
pstldz / dcat-admin-grid-sotrable 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('order_column');