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
@@ -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 [];
}
}