/** * @param \Notadd\Foundation\Database\Eloquent\Model $model * @return \Notadd\Foundation\Database\Eloquent\Model */ public function save(Model $model) { $model->setAttribute($this->getPlainForeignKey(), $this->getParentKey()); return $model->save() ? $model : false; }
/** * @param \Notadd\Foundation\Database\Eloquent\Model $model * @param array $joining * @param bool $touch * @return \Notadd\Foundation\Database\Eloquent\Model */ public function save(Model $model, array $joining = [], $touch = true) { $model->save(['touch' => false]); $this->attach($model->getKey(), $joining, $touch); return $model; }