orlyapps / nova-belongsto-depend

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

Reduce the amount of unnecessary data sent #5

Closed glennwilton closed 6 years ago

glennwilton commented 6 years ago

In the documentation the options() and optionsResolve() send the full records as JSON to the frontend.

It would be better to filter these by the modelKeyName and valueKey so only send whats required.

Alternatively change the documentation as below to only get the required fields.

->optionsResolve(function ($customer) {
     return $customer->sites()->get(['siteID', 'siteDescription']);
})
orlyapps commented 6 years ago

Thanks 👍 I have decided you change the README.