great news! You don't have any validation errors (or you didn't validate, or you didn't post your form data)
$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
@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 you expecting some advice based on zero information?
@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
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
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?
also when I output dd($errors->all()) it shows an array of validation errors
Can we see that?
@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.