theUnforgiven's avatar

What is the best way to handle multiple uploads using `updateOrCreate`

Hi all,

I'm using the following to save/update a bunch of form fields Profile::updateOrCreate(['user_id' => $request->user_id], $request->except('_token', 'name', 'uuid')); which works great, but I have a few file fields I need to upload, resize and send to Amazon S3 at the same time.

Here's the form layout

One document for CV, one image for main image and one image for profile, then I have an image gallery that the user will be able to upload multiple images.

My questions is based on using the updateOrCreate method how would I get all these images and file to upload at the same time whilst resizing and uploading to S3?

0 likes
3 replies
koossaayy's avatar

I've never used S3, but assuming it's like the upload to local disk, But you may handle them one by one, resize and all of that, then upload , also one by one, to S3, then after that use updateOrCreate to update the fields

theUnforgiven's avatar

Yes like local disk in that respect, but using the updateOrCreate method like I'm using is the part I'm unsure of, and how to make sure the images get stored to the same record.

Please or to participate in this conversation.