From e3541c8d467f43a0fd4aba33e54822bc32423cfd Mon Sep 17 00:00:00 2001 From: Michalis Antoniou Date: Sat, 25 Mar 2017 00:27:16 +0200 Subject: [PATCH] =Includes hidden fields on update and create --- src/Prettus/Repository/Eloquent/BaseRepository.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); }