예제 #1
0
 /**
  * @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;
 }
예제 #2
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;
 }