diff --git a/src/Fields/Media.php b/src/Fields/Media.php index 8ec48f60..2b615d87 100644 --- a/src/Fields/Media.php +++ b/src/Fields/Media.php @@ -222,6 +222,12 @@ private function addNewMedia(NovaRequest $request, $data, HasMedia $model, strin return $value instanceof UploadedFile || is_array($value); })->map(function ($file, int $index) use ($request, $model, $collection) { if ($file instanceof UploadedFile) { + foreach ($this->customPropertiesFields as $field) { + $requestAttribute = "__media-custom-properties__.{$collection}.{$index}.{$field->attribute}"; + $properties[$field->attribute] = $request->input($requestAttribute); + $this->customProperties($properties); + } + $media = $model->addMedia($file)->withCustomProperties($this->customProperties); $fileName = $file->getClientOriginalName();