PHP code example of bostos / reorderable-columns

1. Go to this page and download the library: Download bostos/reorderable-columns 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/ */

    

bostos / reorderable-columns example snippets


use Bostos\ReorderableColumns\ReorderableColumnsPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ... other configurations
        ->plugin(
            ReorderableColumnsPlugin::make()
                ->persistToSession() // or ->persistToDatabase()
        );
}

use Bostos\ReorderableColumns\Concerns\HasReorderableColumns;
use Filament\Resources\Pages\ListRecords;

class ListUsers extends ListRecords
{
    use HasReorderableColumns;

    protected static string $view = 'filament.resources.users.pages.list-users';
}

use Filament\Tables\Table;

public static function table(Table $table): Table
{
    return $table
        ->columns([
            // your columns
        ])
        ->filters([
            // your filters
        ])
        ->actions([
            // your actions
        ])
        ->reorderableColumns('users'); // Use a unique key
}
bash
php artisan vendor:publish --tag="reorderable-columns-migrations"
php artisan migrate
blade
{{ $this->table }}