Using nested relationship as option labels / titleAttribute for Select field
I have a relationship Select field in my form that stores product_sku_id which is the id for my ProductSku model. My ProductSku model does not store attribute values, like
Small
or Large
, because those are stored in the AttributeValue model, which ProductSku has a ManyToMany relationship with.
So I can easily use the sku
attribute as the titleAttribute for the option labels, as it is an attribute on the ProductSku model. But I want to use ProductSku::attributeValues->value
as the titleAttribute instead. Is there a way to achieve this by using eloquent relationships? Or am I forced to store the attribute values on the product_skus table directly to make this work?
Here is my current product_sku_id Select field with a hopeful attempt to get this to work, but unsuccessfully:
I have seen people using something like this to save data to relationships:
But I am not sure if and how this could be used for my use case, as I still need my select field to store the
product_sku_id`.
Any help is highly appreciated!0 Replies