简体   繁体   中英

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?

这是框架中的一个错误,今天就修好了: https//github.com/laravel/laravel/commit/a9bddfc0e0573aa2b6d9d553126e9bf0af064e7b

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM