Skip to content

Conversation

@dencarlsson
Copy link

Summary

This update allows map() to return multiple rows per item when exporting to CSV.
If the first element returned from map() is an array, it will now be treated as a list of sub-rows, which are iterated and written individually.
This function is available in laravel-excel.

Example use case

A typical scenario is when exporting data from a parent model with related items — for example, Users with their Cars.
Each car should produce its own CSV row, but it’s more convenient to reuse the existing logic and filtering on the User model rather than switch to the Car model and duplicate logic and/or filtering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant