/** * Associate the model instance to the given parent. * * @param \Nova\Database\ORM\Model $model * @return \Nova\Database\ORM\Model */ public function associate(Model $model) { $this->parent->setAttribute($this->foreignKey, $model->getAttribute($this->otherKey)); return $this->parent->setRelation($this->relation, $model); }