headers->set('Authorization', 'Bearer ' . $token); } public function export(Request $request) { $exportsTransactions = new ExportsCustomersWalletTransactionHistory($request); $exportFileName = $request->route('marking') . '-wallet-' . ($request->route('is_precise') == 'true' ? 'precise-' : '') . 'transaction-history.xls'; $filesystemDriver = Storage::getDefaultDriver(); if($filesystemDriver === 's3'){ return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $exportsTransactions) ]); } else{ $response = $exportsTransactions->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']); ob_end_clean(); return $response; } } }