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