© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•5mo ago•
2 replies
Zamion101

How to save relationship of `SpatieMediaLibraryFileUpload` to `statePath`

I am trying to store the
uuid
uuid
of the media record in
statePath
statePath
of the form (example:
data.form_answers.bank_statements
data.form_answers.bank_statements
) where
form_answers
form_answers
is the
statePath
statePath
and
bank_statement
bank_statement
is the field
key/name
key/name
.

Currently SpatieMediaLibraryFileUpload retrieves all the media records from the given
collection
collection
and does not respect (not even save to)
statePath
statePath
.

In this case if I have let's say collection named
documents
documents
and 2 SpatieMediaLibraryFileUpload components with keys
bank_statements
bank_statements
,
application_form
application_form
, after saving the form both of the components shows the combined medias.

In theory I should be able to modify
loadStateFromRelationshipsUsing
loadStateFromRelationshipsUsing
to retrieve the medias from the uuid array in
data.form_answers.<field_key>
data.form_answers.<field_key>
and also save the media
uuid
uuid
back to
statePath
statePath
.

I tried lot's of things but unable to achieve what I need.

I tried adding
->dehydrated()
->dehydrated()
which does not save the uuids.

I am seeking help to find a way to achieve this.
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How to save relationship first
FilamentFFilament / ❓┊help
2y ago
SpatieMediaLibraryFileUpload is ignoring relationship
FilamentFFilament / ❓┊help
10mo ago
SpatieMediaLibraryFileUpload Save on Upload
FilamentFFilament / ❓┊help
2y ago
ReplicateAction. How save relationship
FilamentFFilament / ❓┊help
3y ago