dmitrybubyakin / nova-medialibrary-field

Laravel Nova field for managing the Spatie media library
MIT License
262 stars 62 forks source link

`attachExisting` doesn't transfer custom properties #169

Open Anticom opened 1 year ago

Anticom commented 1 year ago

When attaching existing media the custom properties don't get transferred over to the new media.

I thought I could solve this by implementing my own attachCallback, however it always gets passed an UploadedFile, even when using existing media.

Is it feasible to implement an attachExistingCallback etc. that's getting passed the existing Media instance instead of an UploadedFile and utilize spatie's copy method for a default implementation of the callback? The obvious benefit would be to get full access to the existing media with all attached custom properties, etc. Additionally that way we could also easily implement moving the files from one collection to another instead of copying them.