'OctoberCMS: Access parent model in relation form

I am creating an interface in the backend where the parent model has a belongsToMany relationship which is handled via a relation manager widget.

When creating the related model I need to be able to access the model (and relationships) of the model in the parent form in order to populate the child form correctly.

Unfortunately I was not able to find how to do this, can someone shed some light into this problem?



Solution 1:[1]

If I understand you right. I think you are looking for the relation manager.

This is the section in the documents that you should look at.

"Before relations can be managed on any page, the target model must first be initialized in the controller by calling the initRelation method."

$this->initRelation($post);

Check this awesome video. Note that it was done with v1 of OctoberCMS but besides visually looking off it should still work the same.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pettis Brandon