headers->set('Authorization', 'Bearer '.$token); } public function export(Request $request) { $startDate = $request->query('start_date'); $endDate = $request->query('end_date'); $exportsPendingArrangementDeliveryList = new ExportsArrivedParcel($startDate, $endDate); $exportFileName = 'arrived-parcel.xlsx'; $filesystemDriver = Storage::getDefaultDriver(); if($filesystemDriver === 's3'){ return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $exportsPendingArrangementDeliveryList) ]); } else{ $response = $exportsPendingArrangementDeliveryList->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']); ob_end_clean(); return $response; } } public function summary(Request $request) { $exportsParcelsSummary = new ExportsParcel(); $exportFileName = 'parcel-summary.xls'; $filesystemDriver = Storage::getDefaultDriver(); if($filesystemDriver === 's3'){ return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $exportsParcelsSummary) ]); } else{ $response = $exportsParcelsSummary->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']); ob_end_clean(); return $response; } } public function guangZhou2ToJohor(Request $request) { $exportsWarehousePackingList = new ExportsWarehousePackingList(); $exportFileName = 'guangzhou2-to-johor-summary.xls'; $filesystemDriver = Storage::getDefaultDriver(); if($filesystemDriver === 's3'){ return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $exportsWarehousePackingList) ]); } else{ $response = $exportsWarehousePackingList->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']); ob_end_clean(); return $response; } } public function aging(Request $request) { $data = new ExportsAgingList(); $exportFileName = 'aging_report.xls'; $filesystemDriver = Storage::getDefaultDriver(); if($filesystemDriver === 's3'){ return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $data) ]); } else{ $response = $data->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']); ob_end_clean(); return $response; } } }