Skip to content

Commit

Permalink
prevent computed field hydration
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Nov 25, 2023
1 parent eed9eaf commit d413576
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Fields/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d413576

Please sign in to comment.