headers->set('Authorization', 'Bearer '.$token); } public function export(ExportsCustomers $exportsCustomers, Request $request){ $exportFileName = 'customers.csv'; $filesystemDriver = Storage::getDefaultDriver(); if($filesystemDriver === 's3'){ return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $exportsCustomers) ]); } else{ return $exportsCustomers->download($exportFileName, Excel::CSV, ['Content-Type' => 'text/csv']); } } public function exportCurrencyVendorOrder(ExportCurrencyVendorOrder $exportCurrencyVendorOrder, Request $request){ $exportCurrencyVendorOrder = new ExportCurrencyVendorOrder($request); $exportFileName = 'CurrencyVendorOrder.xls'; $filesystemDriver = Storage::getDefaultDriver(); if($filesystemDriver === 's3'){ return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $exportCurrencyVendorOrder) ]); } else{ $response = $exportCurrencyVendorOrder->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']); ob_end_clean(); return $response; } } public function transactions(ExportsTransactions $exportsTransactions, Request $request){ $exportFileName = 'transactions.csv'; $filesystemDriver = Storage::getDefaultDriver(); if($filesystemDriver === 's3'){ return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $exportsTransactions) ]); } else{ return $exportsTransactions->download($exportFileName, Excel::CSV, ['Content-Type' => 'text/csv']); } } public function nullDebtor(ExportsNullDebtors $exportsNullDebtors, Request $request){ $exportFileName = 'nullDebtor.xls'; $filesystemDriver = Storage::getDefaultDriver(); if($filesystemDriver === 's3'){ return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $exportsNullDebtors) ]); } else{ $response = $exportsNullDebtors->download($exportFileName, 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 whiteFormTransactions(Request $request){ $exportsTransactions = new ExportsWhiteFormTransactions($request); $exportFileName = 'white-form-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 walletTransactions(Request $request){ $exportsTransactions = new ExportsWalletTransactions($request); $exportFileName = 'wallet-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 invoiceTransactions(Request $request){ $exportsTransactions = new ExportsInvoiceTransactions($request); $exportFileName = 'invoice-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 receiptTransactions(Request $request){ $exportsTransactions = new ExportsReceiptTransactions($request); $exportFileName = 'receipt-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 bookingTransactions(ExportsBookingTransactions $exportsBookingTransactions, Request $request){ $exportFileName = 'bookingTransactions.xls'; $filesystemDriver = Storage::getDefaultDriver(); if($filesystemDriver === 's3'){ return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $exportsBookingTransactions) ]); } else{ $response = $exportsBookingTransactions->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']); ob_end_clean(); return $response; } } public function leadsData(ExportsLeadsTransactions $exportsLeadsTransactions, Request $request){ $exportFileName = 'leadsData.xls'; $filesystemDriver = Storage::getDefaultDriver(); if($filesystemDriver === 's3'){ return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $exportsLeadsTransactions) ]); } else{ $response = $exportsLeadsTransactions->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']); ob_end_clean(); return $response; } } public function importedInvoiceMapped(ExportsImportedInvoiceMappeds $exportsImportedInvoiceMappeds, Request $request) { $exportFileName = $request->input('fileName').'.xls'; $filesystemDriver = Storage::getDefaultDriver(); if($filesystemDriver === 's3'){ return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $exportsImportedInvoiceMappeds) ]); } else{ $response = $exportsImportedInvoiceMappeds->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']); ob_end_clean(); return $response; } } public function importedReceiptMapped(ExportsImportedReceiptMappeds $exportsImportedReceiptMappeds, Request $request) { $exportFileName = $request->input('fileName').'.xls'; $filesystemDriver = Storage::getDefaultDriver(); if($filesystemDriver === 's3'){ return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $exportsImportedReceiptMappeds) ]); } else{ $response = $exportsImportedReceiptMappeds->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']); ob_end_clean(); return $response; } } }