Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Blade View - Undefined variable: errors

When accessing the login page of my laravel application I get a Undefined variable: errors (View: D:\PhpstormProjects\laravel\resources\views\login.blade.php) error.

According to http://laravel.com/docs/master/validation#error-messages-and-views, $errors should always automatically be set:

So, it is important to note that an $errors variable will always be available in all of your views, on every request, allowing you to conveniently assume the $errors variable is always defined and can be safely used.

This is the blade file:

@extends('layouts.master')

@section('main')
<div id="loginwrapper">
    <h2>Please authenticate</h2>
    @if ($errors->has())
        <div id="error">
            {{ $errors->first() }}
        </div>
    @endif
    {!! Form::open(['id' => 'loginform', 'name' => 'loginform']) !!}
    ... Form stuff ...
    {!! Form::close() !!}
</div>
@stop

The view is being generated by a simple View::make('login'); I am using the laravel 5.0 development version.

Does anyone know the reason for this?

like image 858
Zulakis Avatar asked Oct 21 '22 00:10

Zulakis


1 Answers

This was an error in the framework, just fixed today: https://github.com/laravel/laravel/commit/a9bddfc0e0573aa2b6d9d553126e9bf0af064e7b

like image 183
Zulakis Avatar answered Oct 22 '22 16:10

Zulakis