I have the following situation. I'm using laravel and google cloud storage so basically, I have my own custom filesystem attached to google cloud storage. My code looks like this -
try{
$disk = Storage::disk('gcs');
$disk->put('/service_provider/transports/tech_passports', $file1);
$disk->put('/service_provider/transports/tech_passports', $file2);
$disk->put('/service_provider/transports/pictures', $file3);
$disk->put('/service_provider/transports/pictures', $file4);
$disk->put('/service_provider/transports/pictures', $file5);
$disk->put('/service_provider/transports/pictures', $file6);
} catch(\Exception $e){
}
Now i'm worried. what if the first three files get uploaded and the fourth one has an error. so it will go to catch block and finally, only 3 files will be uploaded which is not what I need.
What I need is all get uploaded or no file gets uploaded just like atomicity. how do I achieve that?