Skip to content

Commit

Permalink
fix: withErrors
Browse files Browse the repository at this point in the history
la methode withErrors defini une variable partagee. Or s'il y'a deja eu un addData, il ne sera pas disponible a l'adapter
  • Loading branch information
dimtrovich committed Jan 25, 2024
1 parent 27a594f commit 77bfc9c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/View/View.php
Expand Up @@ -241,6 +241,10 @@ public function with(array|string $key, mixed $value = null, ?string $context =
$key = [$key => $value];
}

if (isset($key['errors'])) {
$this->withErrors($key['errors']);
}

return $this->addData($key, $context);
}

Expand All @@ -264,7 +268,7 @@ public function withErrors(array|ErrorBag|string $errors): static
$errors = new ErrorBag($messages);
}

$this->share('errors', $errors);
$this->adapter->setVar('errors', $errors);

return $this;
}
Expand Down

0 comments on commit 77bfc9c

Please sign in to comment.