5

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?

4

1 回答 1

3

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

于 2014-10-14T22:17:10.327 回答