Skip to content

Commit b859fce

Browse files
committed
Enable the dotted notation in the ->only() function
1 parent 177b436 commit b859fce

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Processors/DataProcessor.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,17 @@ protected function selectOnlyNeededColumns(array $data)
179179
if (is_null($this->onlyColumns)) {
180180
return $data;
181181
} else {
182-
return array_intersect_key($data, array_flip(array_merge($this->onlyColumns, $this->exceptions)));
182+
$dotted_array = array_intersect_key(
183+
array_dot($data),
184+
array_flip(array_merge($this->onlyColumns, $this->exceptions))
185+
);
186+
187+
$nested_array = [];
188+
foreach ($dotted_array as $key => $value) {
189+
array_set($nested_array, $key, $value);
190+
}
191+
192+
return $nested_array;
183193
}
184194
}
185195

0 commit comments

Comments
 (0)