I can't get my BelongsToMany nor HasMany relationship fields to show on the Create/Edit screen. They show on the Detail view but nowhere else.
I thought that might be how it works but then I saw the following in the docs:
When a BelongsToMany field is shown on a resource creation / update screen, a drop-down selection menu or search menu will display the "title" of the resource
Have any of you been able to get the BelongsToMany or HasMany relationship fields to show on the create/update screens? I'm trying to figure out if I'm doing something wrong.
I experience the same. They work find on the index/detail screen but not the create/update drop downs. There's some open issues on Github I believe might be related to the problem:
@poxin I didn't even know there was a nov-issues repo. Thanks for this. I actually got a response from Taylor Otwell on twitter saying that I'm doing something wrong. Not sure if it would help you but here's the twitter thread: https://twitter.com/bahamagician/status/1034222817619791872
So I'm curious, if you open up dev tools on your browser, do you have a stuck pending request when you are on a create/update page? It's odd that it works fine on index/detail but on create/update I personally hit php timeout or memory limit.
I get stuck on loading: /nova-api/MODEL/associatable/parentMODEL?current=ID&first=false&search=&withTrashed=false
@poxin no, I'm not getting any pending requests. The requests are loading fine but I the belongstomany fields that I defined are just not there. I even checked the response on the creation-fields request and it's not returning the belongstomany field
I thought the issue may have been related, I'm not using BelongsToMany, just BelongsTo. Mine might be related to the fact I have to declare the primaryKey, local, and foreign keys - not sure.
Edit: Ignore. I missed that you had to add ->searchable() on BelongsTo.
From what I found, it's only possible from the "details" of the resource view by design, not on the form ..which is annoying. I would expect it also to appear on the form in a dynamic Vue component that save the associations only when the resource form is submitted. Custom field?
Pretty sure its because they dont want the form to lose its state when you associate another resource..