[Nova] KeyValue Field 设置默认 key 的方式
1. 使用 withMeta:
KeyValue::make('options')
->withMeta([
'value' => $this->options ?? [
'A' => '',
'B' => ''
]
])
2. 或者给模型默认值,form 展示时显示出来。
1. 使用 withMeta:
KeyValue::make('options')
->withMeta([
'value' => $this->options ?? [
'A' => '',
'B' => ''
]
])
2. 或者给模型默认值,form 展示时显示出来。