This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

dragontree
dragontree

I have two tables (products and clients) which are connected with the belongsToMany relationship with pivot data.

When I add a new product to the client then I need to get the default pivot data values from the product. So when I add a new relation, then the pivot data form should already have values populated based on the selected product.

How can I do that?

dragontree
dragontree

Took me ages to figure it out but its quite easy. Just set the defaultFrom attribute in the form configuration:

pivot[price]:
                label: Price
                type: number
                defaultFrom: price

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.