How does laravel get the error message of form validation in controller?

1, I am a beginner ~
2, recently I am doing something, developed with laravel+vue-cli.

the problem I encountered is how to read the error message of validate validation failure directly in controller when carrying out form validation.

the method I know so far is to output the error message of $errors directly in the blade template. But now, I need to get the error message directly in controller, then define it as an interface, read it by vue-cli, and then automatically control the output at the front end.

I don"t know whether the description is clear, but ask for a powerful solution.

Mar.10,2022

$validator = Validator::make()
$validator->messages()

you can get the error message. You can sort out the error message and output it to the template

.
Menu