diff --git a/src/Prettus/Repository/Eloquent/BaseRepository.php b/src/Prettus/Repository/Eloquent/BaseRepository.php index 93a5f2ce..ebe7cf3a 100644 --- a/src/Prettus/Repository/Eloquent/BaseRepository.php +++ b/src/Prettus/Repository/Eloquent/BaseRepository.php @@ -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); } @@ -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); }