Home >Backend Development >PHP Tutorial >The laravel API interface uses Validator and cannot return specific error information that fails verification.
Validator is used in the API interface to verify the form;
When there are items that pass verification;
are all returned
<code>{ "message": "The given data failed to pass validation.", "status_code": 500 }</code>
It is impossible to return specific information that has not passed verification;
When the front-end or mobile terminal receives the returned error message;
It cannot tell the user which item does not meet the requirements;
What I want is this;
<code>{ "message": "邮箱已经注册", "status_code": 500 } { "message": "必须是6-16位的密码", "status_code": 500 }</code>
Dear friends, what should I do?
Dear friends, when writing interfaces with laravel;
How are the submitted form fields verified? How to return verification results?