V
V
Vakha12019-06-01 17:32:46
Laravel
Vakha1, 2019-06-01 17:32:46

Why is the $request->validate() method not returning json errors?

Hello!
I use the ajax method to send an email to this method.

public function uniqEmail(Request $request){
        $request->validate([
            "email"=> "unique:users"
        ]);
    }

If I understand correctly, then if the validation fails, a 442 response should be returned - with errors, for example: "Email data is registered with the node" in json format.
However, the answer comes, but I do not see any errors there.
Error: Request failed with status code 422
at createError (app.js:668)
at settle (app.js:831)
at XMLHttpRequest.handleLoad (app.js:201) Tell me
what could be wrong.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question