$decoded = $spec->options;
}
if (is_array($decoded)) {
- foreach ($decoded as $option) {
+ foreach ($decoded as $i => $option) {
+ if (!isset($option->id) || $option->id === '') {
+ $option->id = $i;
+ }
if (isset($option->fr)) {
- $options[] = $option->fr;
+ $options[$option->id] = $option->fr;
}
}
-
}
$params['options'] = $options;
}
'label' => 'Options',
'type' => 'Table',
'entity_singular' => 'option',
- 'columns' => config('backpack.crud.locales'),
+ 'columns' => array_merge(['id' => '#'], config('backpack.crud.locales')),
'when' => ['type' => 'list'],
'translatable' => false,
]);