@@ -38,9 +38,9 @@ class DataTableExportJob implements ShouldQueue, ShouldBeUnique
38
38
/**
39
39
* Create a new job instance.
40
40
*
41
- * @param array $dataTable
42
- * @param array $request
43
- * @param null $user
41
+ * @param array $dataTable
42
+ * @param array $request
43
+ * @param null $user
44
44
*/
45
45
public function __construct (array $ dataTable , array $ request , $ user = null )
46
46
{
@@ -76,7 +76,7 @@ public function handle()
76
76
77
77
$ type = Str::startsWith (request ('exportType ' ), Type::CSV ) ? Type::CSV : Type::XLSX ;
78
78
$ disk = config ('datatables-export.disk ' , 'local ' );
79
- $ filename = $ this ->batchId . '. ' . $ type ;
79
+ $ filename = $ this ->batchId . '. ' . $ type ;
80
80
81
81
$ path = Storage::disk ($ disk )->path ($ filename );
82
82
@@ -86,7 +86,7 @@ public function handle()
86
86
$ columns = $ oTable ->html ()->getColumns ()->filter ->exportable ;
87
87
$ writer ->addRow (
88
88
WriterEntityFactory::createRowFromArray (
89
- $ columns ->map (fn ($ column ) => strip_tags ($ column ['title ' ]))->toArray ()
89
+ $ columns ->map (fn ($ column ) => strip_tags ($ column ['title ' ]))->toArray ()
90
90
)
91
91
);
92
92
@@ -110,18 +110,21 @@ public function handle()
110
110
$ cells ->push (
111
111
WriterEntityFactory::createCell ($ date , (new StyleBuilder )->setFormat ($ format )->build ())
112
112
);
113
- } else if ($ this ->wantsText ($ column )) {
114
- $ cells ->push (
115
- WriterEntityFactory::createCell ($ value , (new StyleBuilder )->setFormat ($ column ['exportFormat ' ])->build ())
116
- );
117
113
} else {
118
- $ format = $ column ['exportFormat ' ]
119
- ? (new StyleBuilder )->setFormat ($ column ['exportFormat ' ])->build ()
120
- : null ;
121
-
122
- $ value = $ this ->isNumeric ($ value ) ? (float )$ value : $ value ;
123
-
124
- $ cells ->push (WriterEntityFactory::createCell ($ value , $ format ));
114
+ if ($ this ->wantsText ($ column )) {
115
+ $ cells ->push (
116
+ WriterEntityFactory::createCell ($ value ,
117
+ (new StyleBuilder )->setFormat ($ column ['exportFormat ' ])->build ())
118
+ );
119
+ } else {
120
+ $ format = $ column ['exportFormat ' ]
121
+ ? (new StyleBuilder )->setFormat ($ column ['exportFormat ' ])->build ()
122
+ : null ;
123
+
124
+ $ value = $ this ->isNumeric ($ value ) ? (float ) $ value : $ value ;
125
+
126
+ $ cells ->push (WriterEntityFactory::createCell ($ value , $ format ));
127
+ }
125
128
}
126
129
});
127
130
@@ -131,7 +134,7 @@ public function handle()
131
134
}
132
135
133
136
/**
134
- * @param \Yajra\DataTables\Html\Column $column
137
+ * @param \Yajra\DataTables\Html\Column $column
135
138
* @return bool
136
139
*/
137
140
protected function wantsDateFormat (Column $ column ): bool
@@ -144,7 +147,7 @@ protected function wantsDateFormat(Column $column): bool
144
147
}
145
148
146
149
/**
147
- * @param mixed $value
150
+ * @param mixed $value
148
151
* @return bool
149
152
*/
150
153
protected function isNumeric ($ value ): bool
@@ -158,7 +161,7 @@ protected function isNumeric($value): bool
158
161
}
159
162
160
163
/**
161
- * @param \Yajra\DataTables\Html\Column $column
164
+ * @param \Yajra\DataTables\Html\Column $column
162
165
* @return bool
163
166
*/
164
167
protected function wantsText (Column $ column ): bool
0 commit comments