You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a use case where I am using both map() and headings() in my export, and I want to conditionally add columns depending on a condition within the row record. It's simple enough to add them in map() as needed, but it appears that I can't add the headings in headings(), because it's a read only method, and the row object isn't available. My thought was to add a property to the class, but that won't work, because the export is called on a per-export basis, not per record.
public function export($start, $end)
{
return Excel::download(new TreasuryReportExport($start, $end), 'TreasuryReport.csv');
}
Is there a way I can conditionally add my header rows on a per-record basis?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a use case where I am using both
map()
andheadings()
in my export, and I want to conditionally add columns depending on a condition within the row record. It's simple enough to add them inmap()
as needed, but it appears that I can't add the headings inheadings()
, because it's a read only method, and the row object isn't available. My thought was to add a property to the class, but that won't work, because the export is called on a per-export basis, not per record.Is there a way I can conditionally add my header rows on a per-record basis?
Beta Was this translation helpful? Give feedback.
All reactions