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 2
2
3
3
namespace Yajra \DataTables \Jobs ;
4
4
5
+ use Box \Spout \Common \Helper \CellTypeHelper ;
5
6
use Box \Spout \Common \Type ;
6
7
use Box \Spout \Writer \Common \Creator \Style \StyleBuilder ;
7
8
use Box \Spout \Writer \Common \Creator \WriterEntityFactory ;
@@ -73,15 +74,19 @@ public function handle()
73
74
$ writer ->openToFile (storage_path ('app/exports/ ' . $ this ->batchId . '. ' . $ type ));
74
75
75
76
$ 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
+ );
77
82
78
83
foreach ($ dataTable ->getFilteredQuery ()->cursor () as $ row ) {
79
84
$ cells = collect ();
80
85
$ columns ->map (function (Column $ column , $ index ) use ($ row , $ cells ) {
81
86
$ property = $ column ['data ' ];
82
87
$ value = $ row ->{$ property } ?? '' ;
83
88
84
- if ($ value instanceof \DateTime || $ this ->wantsDateFormat ($ column )) {
89
+ if (CellTypeHelper:: isDateTimeOrDateInterval ( $ value) || $ this ->wantsDateFormat ($ column )) {
85
90
$ date = $ value ? Date::dateTimeToExcel (Carbon::parse ($ value )) : '' ;
86
91
$ defaultDateFormat = config ('datatables-export.default_date_format ' , 'yyyy-mm-dd ' );
87
92
$ format = $ column ['exportFormat ' ] ?? $ defaultDateFormat ;
You can’t perform that action at this time.
0 commit comments