Ejemplo n.º 1
0
 /**
  * Save a new model and attach it to the parent model.
  *
  * This makes sure we add the from_field_id to the 'pivot' table
  *
  * @param  \Illuminate\Database\Eloquent\Model  $model
  * @param  array  $joining
  * @param  bool   $touch
  * @return \Illuminate\Database\Eloquent\Model
  */
 public function save(Model $model, array $joining = [], $touch = true)
 {
     if (empty($joining) && $this->fromFieldId) {
         $joining = [static::$fromFieldKey => $this->fromFieldId];
     }
     return parent::save($model, $joining, $touch);
 }