F
Filament4mo ago
Jon

How can I save data (TAGS) into a M:M polymorphic array? I have been struggling w/ this for months

GOAL: Loop through tags (ratings) that correspond to the Hobby model: Sample data: https://imgur.com/a/WDe6Z19 An example: if the taggable table lists tag_id 2 [solo] belongs to hobby id 1 , TAG 2 would be a child to tag 1 [activity type] in which the rendered selects would simply loop through all parent ratings, and then child ratings of each and if a hobby has a child connection, it marks it as selected. Parent Tags in this case will never be a selected option, they only serve to create the input label: The child tags form the input's options Selected values need to be saved to hobbyRatings relationship which is a M:M polymorphic relationship: I have tried to make this work in several ways which i will post below. I can get the select statements to load properly, but they are not saving. Note, this ratings form is a sub form within the hobbyResource. The hobby-specific data saves, but I cannot get the rating data to save. nor do i have a clue how to view the "data" object to see how i might need to format the code differently. Any help would be greatly appreciated. To keep this short here are the questions on LARACASTS: https://laracasts.com/discuss/channels/filament/filament-v3-adding-a-livewire-component -- this attempt using livewire https://laracasts.com/discuss/channels/filament/how-do-i-manually-save-a-generated-field-with-filament --this attempt directly in the resource
Laracasts
Laracasts
1 Reply
Jon
Jon4mo ago
is there any way to get help with this?