Inserting pivot data without RelationManager
I have a multiple select on an edit page, has a
belongsToMany()
relationship.
I want to inject something to be saved in a column in the pivot table.
I found out that the relationship is saved in HasState::getState()
, but could not find a way to inject additional data to it.
Tried mutateFormDataBeforeSave()
in the EditThing component, but that gets called after getState()
, so no effect.
Any help would be appreciated.9 Replies
Upping this in case it gets some attention on a Monday.
Can you give an example of the kind of data you are trying to save to the pivot table?
Do you think you could use a lifecycle hook like
afterSave()
?@pboivin does not help my case as it's called after
getState
GitHub
filament/packages/forms/src/Components/Concerns/BelongsToModel.php ...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
This might just resolve my issue, I'm going to try and post here.
Can confirm I can plug in and call my own action to save the relationship to inject additional data into the pivot row using
saveRelationshipsUsing(function ($component, $state, $get)
GitHub
Save CheckboxList with Pivot Attribute · filamentphp filament · Dis...
Hi, Is there a way to save a CheckboxList with a Pivot Attribute? Say I have three tables event dance style and a pivot table where style_id is the pivot attribute event_dance -event_id -dance_id -...
This was helpful
Wish it was discoverable via the docs.