-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Description
When using a Nova Stack field and exporting a Nova resource to Excel the value inside the cell is empty
Example field:
Stack::make(__('Stack field'), [
Text::make(__('Some value'), 'some.value'),
Text::make(__('Something else'), 'something.else'),
]),
In the file:
Maatwebsite\LaravelNovaExcel\Actions inside the method replaceFieldValuesWhenOnResource the values are resolved using $field->value. This will output NULL in case of a Stack field.
It would be nice to have all of the fields inside a Stack field to be automatically flattened. I've solved it (in my index fields) by adding this:
foreach ($fields as $index => $field)
if ($field->component === 'stack-field' && $field->lines) {
unset($fields[$index]);
foreach ($field->lines as $item => $line) {
$fields = array_merge(array_slice($fields, 0, $index + $item), [$line], array_slice($fields, $index + $item));
}
}
}
Kind regards,
Marco
rderks88
Metadata
Metadata
Assignees
Labels
No labels