Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

242Studios's avatar

BelongsToMany Fields on Creation/Update Screen

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.

-=Chris

0 likes
9 replies
poxin's avatar

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

242Studios's avatar

@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

poxin's avatar

Ah okay, mine shows the dropdown but never loads the list.

242Studios's avatar

Is it possible for me to see how you've defined your resources? I'm not even getting a field.

poxin's avatar

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.

isometriq's avatar

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..

Please or to participate in this conversation.