Is there a way to trigger a RelationManager "create" action from a Widget action ?
On my Mission edit page, I have a table widget that list Users according to certain criteria. I created a button for each row that allow to create a Proposal to the User for the current Mission. The "create a Proposal" modal is already available in the "ProposalRelationManager" above. I was wondering if I can trigger the "ProposalRelationManager" create action instead of duplicate code in my Widget ?
3 Replies
add in the relation manager
dispatch it via action
Thanks a lot @Leandro Ferreira ! And do you know howI can pass data to the form, to prefill it ? Like
->dispatch('openPropositionAction', ['user_id' => 15])
and then fill my Forms\Components\Select::make('user_id')
in my create form ?hum, I don't know
you can use fillForm or mountUsing to fill the data I guess
https://filamentphp.com/docs/3.x/actions/modals#filling-the-form-with-existing-data