public function associate($model)
{
$otherKey = $model instanceof Model ? $model->getAttribute($this->otherKey) : $model;
$this->parent->setAttribute($this->foreignKey, $otherKey);
if ($model instanceof Model) {
$this->parent->setRelation($this->relation, $model);
}
return $this->parent;
}