This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I'm trying to make a relation field show a dropdown-like selection for a model I have called Buy which has many ItemsCatalgue. The drop down should just show the id of the model ItemsCatalogue.
here is my code for the fields.yaml:
fields:
id:
label: ID
disabled: true
span: auto
itemcat:
label: Quote No
disabled: false
type: relation
select: id
And here is my code for the model Buy (which is the model I'm using to access the items from the ItemsCatalogue Model):
'itemcat' => ['Lives\Sales\Models\ItemCatalogue', 'key' => 'id']
I am only getting empty results, but the ItemCatalogue has data in it.
Anyone know what I am doing wrong?
Thank you
Last updated
It would help having a bit more information as you show tiny bits of code which don't give enough perspective. Also having the database table field definition would help.
Hi mjauvin. Thanks for replying. I resolved the issue on my end. It was due to my lack of understanding relations. I had put the itemcat variable in the wrong relationship [HasMany instead of BelongsTo in my Buy Model] and it affected how the fields displayed the information. Apologies for not giving enough detail.
Thanks
Last updated
1-3 of 3