mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-26 07:53:58 +00:00
Laravel Vapor - sync code for download files in bulk from S3 to more files
This commit is contained in:
@@ -13,6 +13,7 @@ use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Str;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Maatwebsite\Excel\Excel as ExcelFileTypes;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class ImportUpdateDebtorController
|
||||
{
|
||||
@@ -23,7 +24,18 @@ class ImportUpdateDebtorController
|
||||
*/
|
||||
public function import(Request $request) {
|
||||
$object = new DocumentObject('', $request->input('files'), '', ApprovalStatus::APPROVED, 'imports');
|
||||
Excel::import(new ImportsDebtor(), json_decode($object->getFiles()[0])->file_info->original->file);
|
||||
$file = json_decode($object->getFiles()[0])->file_info->original->file;
|
||||
|
||||
$filesystemDriver = Storage::getDefaultDriver();
|
||||
if($filesystemDriver === 's3'){
|
||||
$file = Storage::disk('s3')->path('documents/' . $file);
|
||||
}
|
||||
//Shipping Portal requires the following (NOT TESTED)
|
||||
// else{
|
||||
// $file = 'documents/' . $file;
|
||||
// }
|
||||
|
||||
Excel::import(new ImportsDebtor(), $file);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user