/** * Create a new has many relationship instance. * * @param \LMongo\Eloquent\Builder $query * @param \LMongo\Eloquent\Model $parent * @param string $foreignKey * @param string $otherKey * @return void */ public function __construct(Builder $query, Model $parent, $foreignKey, $otherKey) { $this->otherKey = $otherKey; $this->foreignKey = $foreignKey; parent::__construct($query, $parent, $foreignKey); }
/** * 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); }