Skip to content

How to validate a DTO without causing the page to go back!? #386

Answered by raveren
raveren asked this question in Q&A
Discussion options

You must be logged in to vote
try {
    MyDtoClass::validateAndCreate($payload);
} catch (ValidationException $exception) {
     // do your incredible logic here, for example dd($exception->validator->getMessageBag());
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by raveren
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant