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

anton_shever's avatar

Nova BelongsTo group

Is this possible to group the dropdown values in the BelongsTo relation?

0 likes
7 replies
vincent15000's avatar

I really don't understand what you need. Can you explain and give us an example ?

anton_shever's avatar

@vincent15000 Thanks for your reply. Of course, look

I have the Product model that belongsTo Category model. But only a subcategory can be attached to a product. Therefore, when creating a product, i need to show only subcategories grouped by category. understood what I mean?

Models

Product: id, ..., ..., categoty_id

Category: id, ..., parent_id

1 like
vincent15000's avatar

@anton_shever To be sure ... in your dropdown, you want something like this ?

My first category
- subcategory 1
- subcategory 2

My second category
- subcategory 3
- subcategory 4
anton_shever's avatar

@vincent15000 yes, exactly. but this should be implemented with BelongsTo, in order to keep relation links on index and other pages

1 like
vincent15000's avatar

@anton_shever I think that it's not possible natively. I don't know if it exists any plugin to add this functionality.

1 like
anton_shever's avatar

@david thanks, but this should be implemented with BelongsTo, in order to keep relation links on index and other pages

Please or to participate in this conversation.