$get function for select options
Toggle::make('unavailable_since')
->reactive()
->dehydrated(false)
->afterStateUpdated(function ($state, $set, $record) {
$optionIndex = [
null => null,
false => 0,
true => 1][$state ? null : $record?->approved];
$set('approved', $optionIndex);
}),
Select::make('approved')->options([
null => __('Under Review'),
false => __('Refused'),
true => __('Approved'),
])
->in(fn(Get $get): array =>
$get('unavailable_since') ? [null, "0"] : [null, "0", "1"]
)
I have this 2 synced fields, why am i forced to cast false and true to string? I'm i missing something?
I expected $get('unavailable_since') to be null, false or true. Not "0" or "1".0 Replies