Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dougd_nc's avatar

getting last submit errors in PHP

Say I do something like this

$request->validate([
    'title' => 'required|unique:posts|max:255',
    'body' => 'required',
    'publish_at' => 'nullable|date',
]);

The input doesn't validate, then a redirect back to the page with the form happens.

If I want to get the list of errors in PHP code how would I do that?

0 likes
4 replies
dougd_nc's avatar

to maybe clarify my question:

  1. validator raises exception
  2. Laravel redirects to previous page
  3. I can get the form values in the PHP using old().

What is the specific code I can use in (any) PHP to get the errors from the validator

Please or to participate in this conversation.