headers->set('Authorization', 'Bearer '.$token); return $exportsCustomers->download('customer-latest-order-date.csv', Excel::CSV, ['Content-Type' => 'text/csv']); } public function nullDebtor(ExportsNullDebtors $exportsNullDebtors, Request $request){ $exportFileName = 'nullDebtor.xlsx'; $filesystemDriver = Storage::getDefaultDriver(); if($filesystemDriver === 's3'){ return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $exportsNullDebtors) ]); } else{ $response = $exportsNullDebtors->download('nullDebtor.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']); ob_end_clean(); } return $response; } public function paymentTransactions(Request $request){ $exportsTransactions = new ExportsPaymentTransactions($request); $exportFileName = 'payment-transactions.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; } } public function groupTransaction(Request $request){ $exportsTransactions = new ExportsGroupTransactions($request); $response = $exportsTransactions->download('group-transactions.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']); ob_end_clean(); return $response; } public function totalOrders(Request $request){ $exportsTotalOrders = new ExportsCustomerTotalOrderByYear($request); $exportFileName = 'total-orders-' . $request->route('year') . '.xls'; $filesystemDriver = Storage::getDefaultDriver(); if($filesystemDriver === 's3'){ return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $exportsTotalOrders) ]); } else{ $response = $exportsTotalOrders->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']); ob_end_clean(); return $response; } } }