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

deroccha
deroccha

How would I get in a hasMany relation more column datas than the related ID. Here is an example what I mean `

public $hasMany = [
'invocies => ['Test\MPlugin\Models\Invoice'],
];

than I have a relatinal form in Customers->Customer where I show all the Invocies for a Customer. creating new Invoice requires customer_id what the hasMany already genrating for the relation but before Save I would like to get other column datas from accessed Customer like customer_name, customer_phone

I could make some other query to get the desired informations like

'select customer_name, customer_phone from customers where id ='. $this->customer_id

but I think there is more handy way to do this properly

1-1 of 1

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