/** * Attach a model instance to the parent model. * * @param \LMongo\Eloquent\Model $model * @return \LMongo\Eloquent\Model */ public function save(Model $model) { $model->setAttribute($this->foreignKey, new MongoID($this->parent->getKey())); return $model->save() ? $model : false; }
/** * Attach a model instance to the parent model. * * @param \LMongo\Eloquent\Model $model * @return \LMongo\Eloquent\Model */ public function save(Model $model) { $model->setAttribute($this->morphType, $this->morphClass); return parent::save($model); }