![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/demo.cartinsight.co/vendor/yajra/laravel-datatables-export/src/ |
<?php namespace Yajra\DataTables; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Bus; use Yajra\DataTables\Jobs\DataTableExportJob; /** * @mixin \Yajra\DataTables\Services\DataTable */ trait WithExportQueue { /** * Process dataTables needed render output. * * @param string|null $view * @param array $data * @param array $mergeData * @return mixed * * @throws \Throwable */ public function render(string $view = null, array $data = [], array $mergeData = []) { if (request()->ajax() && request('action') == 'exportQueue') { return $this->exportQueue(); } return parent::render($view, $data, $mergeData); } /** * Create and run batch job. * * @return string * * @throws \Throwable */ public function exportQueue(): string { $job = new DataTableExportJob( [self::class, $this->attributes], request()->all(), Auth::id() ?? 0, $this->sheetName(), ); $batch = Bus::batch([$job])->name('datatables-export')->dispatch(); return $batch->id; } /** * Default sheet name. * Character limit 31. * * @return string */ protected function sheetName(): string { return request('sheetName', 'Sheet1'); } }