Skip to content

Commit 3561959

Browse files
authored
Merge pull request yajra#2084 from Arkhas/9.0
[9.0] Enable the dotted notation in the ->only() function.
2 parents 4f62c6b + 826a6ff commit 3561959

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
@@ -180,7 +180,17 @@ protected function selectOnlyNeededColumns(array $data)
180180
if (is_null($this->onlyColumns)) {
181181
return $data;
182182
} else {
183-
return array_intersect_key($data, array_flip(array_merge($this->onlyColumns, $this->exceptions)));
183+
$results = [];
184+
foreach ($this->onlyColumns as $onlyColumn) {
185+
Arr::set($results, $onlyColumn, Arr::get($data, $onlyColumn));
186+
}
187+
foreach ($this->exceptions as $exception) {
188+
if ($column = Arr::get($data, $exception)) {
189+
Arr::set($results, $exception, $column);
190+
}
191+
}
192+
193+
return $results;
184194
}
185195
}
186196

0 commit comments

Comments
 (0)