예제 #1
0
 /**
  * @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;
 }
예제 #2
0
 /**
  * @param \Notadd\Foundation\Database\Eloquent\Model $model
  * @return \Notadd\Foundation\Database\Eloquent\Model
  */
 public function associate($model)
 {
     $this->parent->setAttribute($this->foreignKey, $model->getKey());
     $this->parent->setAttribute($this->morphType, $model->getMorphClass());
     return $this->parent->setRelation($this->relation, $model);
 }