@@ -38,9 +38,9 @@ class DataTableExportJob implements ShouldQueue, ShouldBeUnique
3838 /**
3939 * Create a new job instance.
4040 *
41- * @param array $dataTable
42- * @param array $request
43- * @param null $user
41+ * @param array $dataTable
42+ * @param array $request
43+ * @param null $user
4444 */
4545 public function __construct (array $ dataTable , array $ request , $ user = null )
4646 {
@@ -76,7 +76,7 @@ public function handle()
7676
7777 $ type = Str::startsWith (request ('exportType ' ), Type::CSV ) ? Type::CSV : Type::XLSX ;
7878 $ disk = config ('datatables-export.disk ' , 'local ' );
79- $ filename = $ this ->batchId . '. ' . $ type ;
79+ $ filename = $ this ->batchId . '. ' . $ type ;
8080
8181 $ path = Storage::disk ($ disk )->path ($ filename );
8282
@@ -86,7 +86,7 @@ public function handle()
8686 $ columns = $ oTable ->html ()->getColumns ()->filter ->exportable ;
8787 $ writer ->addRow (
8888 WriterEntityFactory::createRowFromArray (
89- $ columns ->map (fn ($ column ) => strip_tags ($ column ['title ' ]))->toArray ()
89+ $ columns ->map (fn ($ column ) => strip_tags ($ column ['title ' ]))->toArray ()
9090 )
9191 );
9292
@@ -110,18 +110,21 @@ public function handle()
110110 $ cells ->push (
111111 WriterEntityFactory::createCell ($ date , (new StyleBuilder )->setFormat ($ format )->build ())
112112 );
113- } else if ($ this ->wantsText ($ column )) {
114- $ cells ->push (
115- WriterEntityFactory::createCell ($ value , (new StyleBuilder )->setFormat ($ column ['exportFormat ' ])->build ())
116- );
117113 } 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+ }
125128 }
126129 });
127130
@@ -131,7 +134,7 @@ public function handle()
131134 }
132135
133136 /**
134- * @param \Yajra\DataTables\Html\Column $column
137+ * @param \Yajra\DataTables\Html\Column $column
135138 * @return bool
136139 */
137140 protected function wantsDateFormat (Column $ column ): bool
@@ -144,7 +147,7 @@ protected function wantsDateFormat(Column $column): bool
144147 }
145148
146149 /**
147- * @param mixed $value
150+ * @param mixed $value
148151 * @return bool
149152 */
150153 protected function isNumeric ($ value ): bool
@@ -158,7 +161,7 @@ protected function isNumeric($value): bool
158161 }
159162
160163 /**
161- * @param \Yajra\DataTables\Html\Column $column
164+ * @param \Yajra\DataTables\Html\Column $column
162165 * @return bool
163166 */
164167 protected function wantsText (Column $ column ): bool
0 commit comments