Veraltet

Sie lesen die Dokumentation für 1.x. Aktuell ist 3.x.

Zur Dokumentation für 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 Installationen · 46 Sterne
// COOKIES

Ein paar Cookies halten die Seite am Laufen; andere merken sich Einstellungen oder zählen Besuche. Sie entscheiden.

Cookie-Richtlinie