/** * Attach a model instance to the parent model. * * @param \Database\ORM\Model $model * @return \Database\ORM\Model */ public function save(Model $model) { $model->setAttribute($this->getPlainMorphType(), $this->morphClass); return parent::save($model); }
/** * Attach a model instance to the parent model. * * @param \Database\ORM\Model $model * @return \Database\ORM\Model */ public function save(Model $model) { $model->setAttribute($this->getPlainForeignKey(), $this->getParentKey()); return $model->save() ? $model : false; }