Merge branch 'dillon/34.1-jenkins-vapor' into vapor/development

This commit is contained in:
Dillon Ngo
2024-04-30 13:07:42 +08:00
2 changed files with 15 additions and 3 deletions
+2 -2
View File
@@ -72,13 +72,13 @@ class ExcelHandel
if($filesystemDriver === 's3'){
$filePathForS3 = 'public/excels/' . $path . '/' . $filename . '.' . $extension;
Storage::disk('s3')->put($filePathForS3, $exceldata);
$file_info['original']['file'] = Storage::disk('s3')->path($filePathForS3);
}
else{
$file = Storage::disk('public')->put('excels/' . $path . '/' . $filename . '.' . $extension, $exceldata);
$file_info['original']['file'] = storage_path('app/public/excels/' . $path . '/' . $filename . '.' . $extension);
}
$file_info['original']['file'] = storage_path('app/public/excels/' . $path . '/' . $filename . '.' . $extension);
return $file_info;
}
@@ -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 [];
}
}