Nov 16, 2022
0
Level 1
Nova BelongsToMany Problem
I trying to set value to belongstomany field when Attach, but unfortunately not working
Nova Resource
BelongsToMany::make('Merchants', 'merchants', \App\Nova\MerchantConfiguration\Merchant::class)
// ->searchable()
->default(1)
->resolveUsing(function(){
return 1;
})
->fillUsing(function(){
return 1;
})
->withMeta(['belongsToId' => 1, 'belongsToManyId' => 1, 'value' => 1])
JS
var aa = document.querySelector('form[data-form-unique-id]');
var formUniqueId = aa.dataset.formUniqueId;
Nova.$emit(formUniqueId + '-merchants-value', 1);
Any idea how to set value to belongsToMany?
Or can I replace the dropdown selection (when "Attach") to other input?
Please or to participate in this conversation.