FilamentF
Filament16mo ago
CK

Select and TextColumn with Associative Array

use Filament\Forms\Components\Select;
 
Select::make('status')
    ->options([
        -1 => 'Terminated',
        0 => 'Pending',
        1 => 'Approved',
    ]),


May I make and external array like
$status = [
    -1 => 'Terminated',
    0 => 'Pending',
    1 => 'Approved',
]


Select::make('status')
    ->options($status),

or
Select::make('status')
    ->options($this->status),


and in
TextColumn::make('status'),

how to show the value in state of the key?
eg. when selected -1, show the word 'Terminated' instate of -1.

Thank you
Was this page helpful?