I am using Laravel Nova and have created a custom Field, that gets company info via an api service. This works just fine. Where I am stuck, is when the company data returns I want to fill the rest of the resource form fields with this data. I am almost there, but my Vue skills are not great.
So I created a vue method that is called when the user selects company from the select field. I can send the values, but I am not able to edit the other field vue components and therefore not able to add listeners. Can I update those fields simply by passing the data from the custom field?
fillInputFields (selectedCompanyData) {
this.$parent.$children.forEach(component => {
if (component.field !== undefined && component.field.attribute == 'name') {
component.field.value = selectedCompanyData.name
}
if (component.field !== undefined && component.field.attribute == 'tax_number') {
component.field.value = selectedCompanyData.cvr
}
})
},