Hello Admin, I am currently working on a project in which everything is separated by company, including pivots. I have found the syncRelation function and added:
$model->save(array(
'company_id' => $item->company_id,
$relation->pivotLocalKey => (int)$this->getId(),
$relation->pivotForeignKey => (int)$value
));
It works but lacks the elegance of the code around it. Would like to add a way to pass extra data in the relationship declaration.
$this->belongsToMany('groups', // name
'groups', // foreignModelClass
'id', // localKey
'id', // foreignKey,
'usergroups', // pivotModelClass,
'user_id', // pivotLocalKey
'group_id', // pivotForeignKey
'company_id' // pivotCompanyKey ************
);
Where can I find the relation-field-name declaration?
Thanks
vlemos
Note: final request for today