示例#1
0
 public function save()
 {
     $name = $this->name();
     $value = Input::get($name, '');
     Input::merge([$name => $value]);
     parent::save();
 }
示例#2
0
 public function save()
 {
     $name = $this->name();
     if (!Input::has($name)) {
         Input::merge([$name => 0]);
     }
     parent::save();
 }
示例#3
0
 public function save()
 {
     $name = $this->name();
     if (!\Request::has($name)) {
         \Request::merge([$name => 0]);
     }
     parent::save();
 }
示例#4
0
 public function save()
 {
     $name = $this->name();
     $value = Input::get($name, '');
     if (!empty($value)) {
         $value = explode(',', $value);
     } else {
         $value = [];
     }
     Input::merge([$name => $value]);
     parent::save();
 }
示例#5
0
 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;
         }
     }
 }