5

I have form which i validate in controller when validate fails i got errors by using $myValidator->errors() which returns object of Messagebag but i want only error messages as an array of string?

1

1 Answer 1

14

To retrieve all errors as an array strings for all fields, you can use the all() method.

Like so:

$myValidator->errors()->all();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.