Skip to content

Commit 4b0418f

Browse files
committed
Refactor render override.
1 parent a1348b3 commit 4b0418f

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/WithExportQueue.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Illuminate\Support\Facades\Bus;
66
use Yajra\DataTables\Jobs\DataTableExportJob;
7-
use Yajra\DataTables\Services\DataTable;
87

98
trait WithExportQueue
109
{
@@ -18,19 +17,11 @@ trait WithExportQueue
1817
*/
1918
public function render($view, $data = [], $mergeData = [])
2019
{
21-
if ($this->request()->ajax() && $this->request()->wantsJson()) {
22-
return app()->call([$this, 'ajax']);
20+
if (! $this->request()->wantsJson() && $this->request()->get('action') == 'exportQueue') {
21+
return $this->exportQueue();
2322
}
2423

25-
if ($action = $this->request()->get('action') and in_array($action, array_merge($this->actions, ['exportQueue']))) {
26-
if ($action == 'print') {
27-
return app()->call([$this, 'printPreview']);
28-
}
29-
30-
return app()->call([$this, $action]);
31-
}
32-
33-
return view($view, $data, $mergeData)->with($this->dataTableVariable, $this->getHtmlBuilder());
24+
return parent::render($view, $data, $mergeData);
3425
}
3526

3627
/**

0 commit comments

Comments
 (0)