myrdsrn
732
20
Laravel

$errors variable not available

Posted 3 years ago by myrdsrn

I have installed a new Laravel app and started building a sign-up page and it works fine.

When I go to add the $errors variable to the sign-up page I get the following message.

ErrorException in 6ce283a7bf63c51257885c3e94e0e0d7 line 12:
Undefined variable: errors (View: /var/www/website.com/resources/views/user/signup.blade.php)

I have used the example from the Validation docs.

@if (count($errors) > 0)
    <div class="alert alert-danger">
        <ul>
            @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
            @endforeach
        </ul>
    </div>
@endif

When I comment out the above block everything works.

From my understanding of the docs, "$errors variable will always be available in all of your views on every request" .

Have I done something wrong?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.