Skip to content

Commit d06a6ad

Browse files
detailed input validation exception messages
1 parent 70a5216 commit d06a6ad

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Pecee/Http/Input/Exceptions/InputValidationException.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,15 @@ public function getErrorMessages(): array
3535
{
3636
if($this->getValidation() === null)
3737
return array();
38-
return $this->getValidation()->errors()->all();
38+
$errors = array();
39+
foreach ($this->getValidation()->errors()->toArray() as $key => $rule_errors){
40+
foreach ($rule_errors as $rule => $message){
41+
if(!isset($errors[$key]))
42+
$errors[$key] = array();
43+
$errors[$key][$rule] = (string) $message;
44+
}
45+
}
46+
return $errors;
3947
}
4048

4149
/**

0 commit comments

Comments
 (0)