How to save relationship of `SpatieMediaLibraryFileUpload` to `statePath`
I am trying to store the
uuid of the media record in statePath of the form (example: data.form_answers.bank_statements) where form_answers is the statePath and bank_statement is the field key/name.
Currently SpatieMediaLibraryFileUpload retrieves all the media records from the given collection and does not respect (not even save to) statePath.
In this case if I have let's say collection named documents and 2 SpatieMediaLibraryFileUpload components with keys bank_statements, application_form, after saving the form both of the components shows the combined medias.
In theory I should be able to modify loadStateFromRelationshipsUsing to retrieve the medias from the uuid array in data.form_answers.<field_key> and also save the media uuid back to statePath.
I tried lot's of things but unable to achieve what I need.
I tried adding ->dehydrated() which does not save the uuids.
I am seeking help to find a way to achieve this.1 Reply
Post code you have tried for loadStateFromRelationshipsUsing and saveRelationshipsUsing