File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 22
33namespace Yajra \DataTables \Jobs ;
44
5+ use Box \Spout \Common \Helper \CellTypeHelper ;
56use Box \Spout \Common \Type ;
67use Box \Spout \Writer \Common \Creator \Style \StyleBuilder ;
78use Box \Spout \Writer \Common \Creator \WriterEntityFactory ;
@@ -73,15 +74,19 @@ public function handle()
7374 $ writer ->openToFile (storage_path ('app/exports/ ' . $ this ->batchId . '. ' . $ type ));
7475
7576 $ columns = $ oTable ->html ()->getColumns ()->filter ->exportable ;
76- $ writer ->addRow (WriterEntityFactory::createRowFromArray ($ columns ->pluck ('title ' )->toArray ()));
77+ $ writer ->addRow (
78+ WriterEntityFactory::createRowFromArray (
79+ $ columns ->map (fn ($ column ) => strip_tags ($ column ['title ' ]))->toArray ()
80+ )
81+ );
7782
7883 foreach ($ dataTable ->getFilteredQuery ()->cursor () as $ row ) {
7984 $ cells = collect ();
8085 $ columns ->map (function (Column $ column , $ index ) use ($ row , $ cells ) {
8186 $ property = $ column ['data ' ];
8287 $ value = $ row ->{$ property } ?? '' ;
8388
84- if ($ value instanceof \DateTime || $ this ->wantsDateFormat ($ column )) {
89+ if (CellTypeHelper:: isDateTimeOrDateInterval ( $ value) || $ this ->wantsDateFormat ($ column )) {
8590 $ date = $ value ? Date::dateTimeToExcel (Carbon::parse ($ value )) : '' ;
8691 $ defaultDateFormat = config ('datatables-export.default_date_format ' , 'yyyy-mm-dd ' );
8792 $ format = $ column ['exportFormat ' ] ?? $ defaultDateFormat ;
You can’t perform that action at this time.
0 commit comments