16
16
17
17
class DataTableExportJob implements ShouldQueue, ShouldBeUnique
18
18
{
19
- use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
19
+ use Dispatchable;
20
+ use InteractsWithQueue;
21
+ use Queueable;
22
+ use SerializesModels;
20
23
use Batchable;
21
24
22
25
private string $ dataTable ;
26
+ private array $ attributes ;
23
27
private array $ request ;
24
28
private $ user ;
25
29
26
30
/**
27
31
* Create a new job instance.
28
32
*
29
- * @return void
33
+ * @param array $dataTable
34
+ * @param array $request
35
+ * @param null $user
30
36
*/
31
- public function __construct (string $ dataTable , array $ request , $ user = null )
37
+ public function __construct (array $ dataTable , array $ request , $ user = null )
32
38
{
33
- $ this ->dataTable = $ dataTable ;
39
+ $ this ->dataTable = $ dataTable [0 ];
40
+ $ this ->attributes = $ dataTable [1 ];
34
41
$ this ->request = $ request ;
35
42
$ this ->user = $ user ;
36
43
}
@@ -50,7 +57,7 @@ public function handle()
50
57
$ oTable = resolve ($ this ->dataTable );
51
58
request ()->merge ($ this ->request );
52
59
53
- $ query = app ()->call ([$ oTable , 'query ' ]);
60
+ $ query = app ()->call ([$ oTable-> with ( $ this -> attributes ) , 'query ' ]);
54
61
55
62
/** @var \Yajra\DataTables\QueryDataTable $dataTable */
56
63
$ dataTable = app ()->call ([$ oTable , 'dataTable ' ], compact ('query ' ));
0 commit comments