From 5559a7c53f74f54c02f063d08899d0d7b81427f2 Mon Sep 17 00:00:00 2001 From: zhenghongyang Date: Sun, 13 Sep 2020 15:46:28 +0800 Subject: [PATCH] fix model hiden field --- src/db/src/Eloquent/Builder.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/db/src/Eloquent/Builder.php b/src/db/src/Eloquent/Builder.php index 5448f24d2..fea2f17e9 100644 --- a/src/db/src/Eloquent/Builder.php +++ b/src/db/src/Eloquent/Builder.php @@ -387,7 +387,13 @@ public function hydrate(array $items): Collection $instance = $this->newModelInstance(); return $instance->newCollection(array_map(function ($item) use ($instance) { - return $instance->newFromBuilder($item); + $model = $instance->newFromBuilder($item); + + // overwirte + $model->setModelHidden($this->model->getModelHidden()); + $model->setModelVisible($this->model->getModelVisible()); + + return $model; }, $items)); }