From 125089147b239bfe15d8b70a080e94b309410d04 Mon Sep 17 00:00:00 2001 From: jan-tricks Date: Thu, 11 Jan 2024 11:21:58 +0100 Subject: [PATCH 1/2] fix updating of multiple custom properties --- src/Fields/HandlesCustomPropertiesTrait.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Fields/HandlesCustomPropertiesTrait.php b/src/Fields/HandlesCustomPropertiesTrait.php index e0234fe6..fa0087b4 100644 --- a/src/Fields/HandlesCustomPropertiesTrait.php +++ b/src/Fields/HandlesCustomPropertiesTrait.php @@ -82,9 +82,9 @@ private function fillMediaCustomPropertiesFromRequest(NovaRequest $request, Medi // If we are dealing with nested resources or multiple panels, custom property fields are prefixed. $key = str_replace($collection, '__media-custom-properties__.'.$collection, $requestAttribute); $targetAttribute = "custom_properties->{$field->attribute}"; - $requestAttribute = "{$key}.{$index}.{$field->attribute}"; + $targetRequestAttribute = "{$key}.{$index}.{$field->attribute}"; - $field->fillInto($request, $media, $targetAttribute, $requestAttribute); + $field->fillInto($request, $media, $targetAttribute, $targetRequestAttribute); } $media->save(); From 068890b2c88b29c26fdbb27d6f2c8ebde2fd512e Mon Sep 17 00:00:00 2001 From: Bertrand Kintanar Date: Mon, 6 Jan 2025 11:56:05 +1300 Subject: [PATCH 2/2] Drop Nova 4.0 Support and add Nova 5.0 Support --- composer.json | 2 +- src/Fields/Media.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index b086711c..1e05015e 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "require": { "php": ">=7.4", "laravel/framework": "^8.0|^9.0|^10.0|^11.0", - "laravel/nova": "^4.0", + "laravel/nova": "^5.0", "spatie/laravel-medialibrary": "^8.0|^9.0|^10.0|^11.0" }, "autoload": { diff --git a/src/Fields/Media.php b/src/Fields/Media.php index 8c6443ea..17008b6a 100644 --- a/src/Fields/Media.php +++ b/src/Fields/Media.php @@ -287,7 +287,7 @@ private function removeDeletedMedia($data, Collection $medias): Collection * @param HasMedia|InteractsWithMedia $resource * @param null $attribute */ - public function resolve($resource, $attribute = null): void + public function resolve($resource, ?string $attribute = null): void { $collectionName = $attribute ?? $this->attribute;