orlyapps / nova-belongsto-depend

Larave Nova BelongsTo Field with Dependcy
MIT License
182 stars 65 forks source link

Models with custom ID #1

Closed glennwilton closed 6 years ago

glennwilton commented 6 years ago

Hi

My Models have custom id fields, so any reference to field->id fails, I needed to make a few changes

NovaBelongsToDepend.php Line 86 Change to $this->dependKey = $foreign->getKey();

FormField.vue Line 56 Change to dependKey: dependsOnValue.value[dependsOnValue.field.modelKeyName] Line 97 Change to formData.append(this.field.attribute, this.value[this.field.modelKeyName] || "");

orlyapps commented 6 years ago

Hello,

can you make a pull request?

Thanks 👍

glennwilton commented 6 years ago

Sure, never done one, so always a first time for everything :-)

orlyapps commented 6 years ago

https://github.com/orlyapps/nova-belongsto-depend/commit/85e9a1e90c2b07c3a55c698508990d3f7eb923e9 should fix your problem. Can you try it with this version?

glennwilton commented 6 years ago

Just tried the latest version, CustomID problem fixed.