This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
mihai8287
I have two models in a belongsToMany relation. I have set up a backend form with a repeater widget that allows attaching a number of related models using values from the pivot table. I got it to save the data into the pivot table, but that data is never displayed on the form. Even the number of rows in the repeater widget are correct, but apparently the values never make it to the form fields (they are always null).
Here is my setup:
relation_config.yaml
knowledge:
label: Knowledge
pivot:
form:
fields:
knowledge_id:
label: Field
score:
label: Score
fields.yaml
fields:
title:
label: Academic program title
knowledge:
type: repeater
form:
fields:
knowledge_id:
label: Field
score:
label: Score
in Models\Program.php i have
public $belongsToMany = [
'knowledge' => [
'Blah\Mockup\Models\Knowledge',
'table' => 'blah_knowledge_program',
'primaryKey' => 'program_id',
'foreignKey' => 'knowledge_id',
'pivot' => ['score']
]
];
Am I doing something wrong?
Last updated
1-3 of 3