Skip to content

Commit

Permalink
=Includes hidden fields on update and create
Browse files Browse the repository at this point in the history
  • Loading branch information
michalisantoniou6 committed Mar 24, 2017
1 parent 12aadec commit e3541c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Prettus/Repository/Eloquent/BaseRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ public function create(array $attributes)
// we should pass data that has been casts by the model
// to make sure data type are same because validator may need to use
// this data to compare with data that fetch from database.
$attributes = $this->model->newInstance()->forceFill($attributes)->toArray();
$attributes = $this->model->newInstance()->forceFill($attributes)->makeVisible($this->model->getHidden())->toArray();

$this->validator->with($attributes)->passesOrFail(ValidatorInterface::RULE_CREATE);
}
Expand Down Expand Up @@ -576,7 +576,7 @@ public function update(array $attributes, $id)
// we should pass data that has been casts by the model
// to make sure data type are same because validator may need to use
// this data to compare with data that fetch from database.
$attributes = $this->model->newInstance()->forceFill($attributes)->toArray();
$attributes = $this->model->newInstance()->forceFill($attributes)->makeVisible($this->model->getHidden())->toArray();

$this->validator->with($attributes)->setId($id)->passesOrFail(ValidatorInterface::RULE_UPDATE);
}
Expand Down

0 comments on commit e3541c8

Please sign in to comment.