Skip to content

Commit

Permalink
done!
Browse files Browse the repository at this point in the history
  • Loading branch information
vdariel committed Oct 23, 2023
1 parent fbe6f0b commit a67aaf5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Exportable.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,12 @@ private function writeRowsFromCollection($writer, Collection $collection, ?calla
}

// is_array($first_row) ? $first_row : $first_row->toArray())
$all_rows = $collection->map(function ($value) {
$first_row = $collection->first();
$removableKeys = array_filter(array_keys($first_row ?? []), fn ($key) => str_starts_with($key, '_'));
$all_rows = $collection->map(function ($value) use ($removableKeys) {
foreach ($removableKeys as $toRemove) {
unset($value[$toRemove]);
}
return Row::fromValues($value);
})->toArray();
if ($this->rows_style) {
Expand Down

0 comments on commit a67aaf5

Please sign in to comment.