public function save() { $name = $this->name(); $value = Input::get($name, ''); Input::merge([$name => $value]); parent::save(); }
public function save() { $name = $this->name(); if (!Input::has($name)) { Input::merge([$name => 0]); } parent::save(); }
public function save() { $name = $this->name(); if (!\Request::has($name)) { \Request::merge([$name => 0]); } parent::save(); }
public function save() { $name = $this->name(); $value = Input::get($name, ''); if (!empty($value)) { $value = explode(',', $value); } else { $value = []; } Input::merge([$name => $value]); parent::save(); }
public function save() { if (!$this->canSaveRelation()) { parent::save(); return; } $relationClass = get_class($this->getToManyRelation()); if ($this->instance()->id) { switch ($relationClass) { case 'Illuminate\\Database\\Eloquent\\Relations\\BelongsToMany': case 'Illuminate\\Database\\Eloquent\\Relations\\MorphToMany': $this->getToManyRelation()->detach(); break; case 'Illuminate\\Database\\Eloquent\\Relations\\HasMany': case 'Illuminate\\Database\\Eloquent\\Relations\\MorphMany': $this->detachHasMany(); break; } } }