Skip to content

Commit 0639355

Browse files
committed
Fix exporting data via relationship
1 parent 88401e1 commit 0639355

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Transformers/DataArrayTransformer.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,14 @@ protected function buildColumnByCollection(array $row, Collection $columns, stri
4141
if ($column[$type]) {
4242
$title = $column->title;
4343
if (is_array($column->data)) {
44-
$data = $row[$column->data['filter'] ?? $column->name] ?? '';
44+
$key = $column->data['filter'] ?? $column->name ?? '';
4545
} else {
46-
$data = $row[$column->data] ?? '';
46+
$key = $column->data ?? $column->name;
4747
}
4848

49+
/** @var string $data */
50+
$data = Arr::get($row, $key) ?? '';
51+
4952
if ($type == 'exportable') {
5053
$title = $this->decodeContent($title);
5154
$dataType = gettype($data);

0 commit comments

Comments
 (0)