Replies: 1 comment
-
Facing the same issue, thanks for the temp solution |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When you provide an array of values to the ‘options’ method without keys, say in a CheckboxList or Select, Filament will use the array indices as keys. This is the default behavior of PHP when defining arrays without explicit keys.
$states = ["AL","AK","AZ","AR","CA",...]
->options($states) will save the array as ["0","1","2","3","4",...]
Let’s say in the future if Alabama succeeds from the union again😁 and the array changes to ["AK","AZ","AR","CA",...] then the return results will be invalid.
A work around is to do ->options(array_combine($states, $states)) to create key=>value (["AL" => "AL",…]) to force Filament to save the values but I think it would be better if Filament handled this condition automatically.
Beta Was this translation helpful? Give feedback.
All reactions