Neaktuální

Čtete dokumentaci k verzi 1.x. Aktuální je 3.x.

Přejít na dokumentaci 3.x →

Usage

With an enum

The column works best with a backed enum. The enum should implement HasLabel and HasIcon, and can implement HasColor, as described in the filament documentation:

use Guava\FilamentIconSelectColumn\Tables\Columns\IconSelectColumn;

$table->columns([
    IconSelectColumn::make('status')
        ->options(Status::class),
]);

With arrays

Alternatively, you can pass the options and their icons directly to the column:

IconSelectColumn::make('priority')
    ->options([
        'low' => 'Low',
        'high' => 'High',
    ])
    ->icons([
        'low' => 'heroicon-o-chevron-down',
        'high' => 'heroicon-o-chevron-up',
    ])
    ->colors([
        'low' => 'gray',
        'high' => 'danger',
    ]);

Close on selection

By default the dropdown stays open after a selection. To close it automatically, use closeOnSelection():

IconSelectColumn::make('status')
    ->closeOnSelection();

Validation

The column only accepts values present in the options, so a manipulated request cannot write arbitrary values to the record.

guava/filament-icon-select-column 10K instalací · 46 hvězd
// COOKIES

Pár cookies drží web v chodu; další si pamatují nastavení nebo počítají návštěvy. Vy rozhodujete, co poběží.

Zásady cookies