1616
1717class DataTableExportJob implements ShouldQueue, ShouldBeUnique
1818{
19- use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
19+ use Dispatchable;
20+ use InteractsWithQueue;
21+ use Queueable;
22+ use SerializesModels;
2023 use Batchable;
2124
2225 private string $ dataTable ;
26+ private array $ attributes ;
2327 private array $ request ;
2428 private $ user ;
2529
2630 /**
2731 * Create a new job instance.
2832 *
29- * @return void
33+ * @param array $dataTable
34+ * @param array $request
35+ * @param null $user
3036 */
31- public function __construct (string $ dataTable , array $ request , $ user = null )
37+ public function __construct (array $ dataTable , array $ request , $ user = null )
3238 {
33- $ this ->dataTable = $ dataTable ;
39+ $ this ->dataTable = $ dataTable [0 ];
40+ $ this ->attributes = $ dataTable [1 ];
3441 $ this ->request = $ request ;
3542 $ this ->user = $ user ;
3643 }
@@ -50,7 +57,7 @@ public function handle()
5057 $ oTable = resolve ($ this ->dataTable );
5158 request ()->merge ($ this ->request );
5259
53- $ query = app ()->call ([$ oTable , 'query ' ]);
60+ $ query = app ()->call ([$ oTable-> with ( $ this -> attributes ) , 'query ' ]);
5461
5562 /** @var \Yajra\DataTables\QueryDataTable $dataTable */
5663 $ dataTable = app ()->call ([$ oTable , 'dataTable ' ], compact ('query ' ));
0 commit comments