Add multiple images using spatie media laravel #1751
Unanswered
kingkimohero69
asked this question in
Q&A
Replies: 1 comment
-
Issues section is not for asking help, if you need help use a forum like laracasts. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I new to laravel and PHP coding , i have a product with only one image i want to add more than one, Here is the code i want to edit
`/**
*/
public function store(UploadRequest $request)
{
$input = $request->all();
try {
$upload = $this->uploadRepository->create($input);
$upload->addMedia($input['file'])
->withCustomProperties(['uuid' => $input['uuid']])
->toMediaCollection($input['field']);
} catch (ValidatorException $e) {
Flash::error($e->getMessage());
}
}`
So I tried to make a foreach loop with add media but i think i did not do it correctly, Can you help be with that? Also i used addMultipleMediaForRequest but it accepts only string not file.
Beta Was this translation helpful? Give feedback.
All reactions