FilamentF
Filament2y ago
🍠

Filter enum value from select enum options (get all enum values but selected ones)

Hey everyone, I have a repeater for some attributes of same table, to be able to store multiple data using handleRecordCreation method

one of the repeated attribute is car_type which is a select options using CarType::class enum, so I don't want to display an option that I already used in a previous repeater, do you know how I achieve that?

Forms\Components\Select::make('car_type')
                ->translateLabel()
                ->enum(CarType::class)
                // ->options(CarType::class)
                ->options(function (Forms\Get $get) {
                    $carType = $get('car_type');
                    info($carType);
                    //remove $carType from returned CarType::class
                    return CarType::class;
                })
                ->live()


Thanks in advance!
image.png
Was this page helpful?