Support the ongoing development of Laravel.io →
Blade Validation

Hello! For some reasons I can't access data from error bag. I've assigned them to variable in view but I can't display them.

    @php
    $register_errors = $errors->getBag('register');
    echo($register_errors);
    @endphp
    @foreach($register_errors as $error)
        <li>{{ $error }}</li>
    @endforeach    

echo prints this: {"email":["Email mus\u00ed ma\u0165 spr\u00e1vny form\u00e1t!"],"password":["Heslo mus\u00ed ma\u0165 aspo\u0148 8 charakterov!"],"password_confirmation":["Heslo mus\u00ed ma\u0165 aspo\u0148 8 charakterov!","Hesl\u00e1 sa musia zhodova\u0165!"],"psc":["Pole psc mus\u00ed by\u0165 \u010d\u00edslo."]}

foreach displays nothing, if I try to access them like this: $register_errors->email / $register_errors->email[0] I get no results

I'm sorry for such a newbie question, please bear with me

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.