this code is working but is there a better way for it to make it shorter
if ($request->has('images')) {
$images = [];
foreach ($data['images'] as $image) {
$images[] = UploadImage::uploadImageToStorage($image, 'Feeds/store/' . $data['store_id']);
}
$data['images'] = $images;
}
2
Answers
I think it is must such. But i cannot check it. Please check it yourself.
You may use
array_map
to get this done.