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

Aibat's avatar
Level 2

$errors->any() always empty in Laravel v10.48.4

Hi, I install fresh laravel 10 and when I validate some inputs, $errors->any() always false and $errors->all() is empty

0 likes
11 replies
Snapey's avatar

great news! You don't have any validation errors (or you didn't validate, or you didn't post your form data)

Aibat's avatar
Level 2

@Snapey I'm sorry I didn't write everything as it should be, when validating I have page reloads, but validation errors are not displayed.

Aibat's avatar
Level 2

@Snapey This is my validation

$request->validate([
            'name' => 'required|string',
            'email' => 'required|email|unique:users,email,NULL,id,deleted_at,NULL',
            'password' => 'required|string|min:4',
        ]);

and when I want to show the errors on blade, it didn't show any errors

@if ($errors->any())
    <div class="alert alert-danger alert-dismissible alert-solid alert-label-icon fade show mb-xl-0" role="alert">
        <i class="ri-error-warning-line label-icon"></i>
        <ul>
            @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
            @endforeach
        </ul>
        <button type="button" class="btn-close btn-close-white" data-bs-dismiss="alert" aria-label="Close"></button>
    </div>
@endif
Aibat's avatar
Level 2

Everything works correctly in v10.11.0, but for some reason it doesn't work in version v10.48.4. After submitting the form, the page just reloads, but without displaying validation errors. But when I output dd($errors->any()) it shows true, also when I output dd($errors->all()) it shows an array of validation errors. I can't figure out what the problem is

Snapey's avatar

when I output dd($errors->all()) it shows an array of validation errors

So you just need a way of showing the errors on the page.

Did you try using the @error blade directive?

Aibat's avatar
Level 2

@Snapey , also not displayed

@error('password')
         <div class="alert alert-danger">{{ $message }}</div>
@enderror
Snapey's avatar

also when I output dd($errors->all()) it shows an array of validation errors

Can we see that?

Aibat's avatar
Level 2

@Snapey everything was working properly, it was my fault. Turns out there was a js library that updated the page covertly

Please or to participate in this conversation.