Laravel 5.4 validate() method return 500 with no errors
- Dominant language
- PHP
- Stars
- 9.4k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
| Q | A
| ----------------- | ---
| Bug? | yes
| Framework | Laravel|Lumen
| Framework version | 5.4
| Package version | 1.0.x@dev
| PHP version | 7
#### Actual Behaviour
When the validates() method of the ValidatesRequests trait is called, the response on failed validation doesn't contain the errors. response is
```
{
"error": {
"message": "The given data failed to pass validation.",
"status_code": 500
}
}
```
#### Expected Behaviour
response should be something like
```
{
"error": {
"message": "The given data failed to pass validation.",
"status_code": 500,
"errors": {
"xyz": [
"The xyz field is required."
]
}
}
}
```
#### Steps to Reproduce
call $this->validate() on a Illuminate\Http\Request object
#### Possible Solutions
I currently use the suggestion in this comment: https://github.com/dingo/api/issues/584#issuecomment-201372727
Contributor guide
Assessment
This issue has not been assessed yet.