From d413576f606a942b67a2079d377ae49b7f437c06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=2E=20Nagy=20Gerg=C5=91?= Date: Sat, 25 Nov 2023 09:57:06 +0100 Subject: [PATCH] prevent computed field hydration --- src/Fields/Field.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Fields/Field.php b/src/Fields/Field.php index 965beadb..314ca17e 100644 --- a/src/Fields/Field.php +++ b/src/Fields/Field.php @@ -445,6 +445,10 @@ public function hydrate(Closure $callback): static */ public function resolveHydrate(Request $request, Model $model, mixed $value): void { + if ($this->computed) { + return; + } + if (is_null($this->hydrateResolver)) { $this->hydrateResolver = function (Request $request, Model $model, $value): void { $model->setAttribute($this->getModelAttribute(), $value);