/** * Save the grid. * * @param GridBuilder $builder * @param array $items */ public function save(GridBuilder $builder, array $items = []) { $model = $builder->getGridModel(); $items = $items ?: $builder->getRequestValue('items'); foreach ($items as $index => $item) { /* @var EloquentModel $entry */ $entry = $model->find($item['id']); $entry->{$builder->getGridOption('sort_column', 'sort_order')} = $index + 1; $entry->save(); } }