Home:ALL Converter>Laravel Blade View - Undefined variable: errors

Laravel Blade View - Undefined variable: errors

Ask Time:2014-10-15T05:56:50         Author:Zulakis

Json Formatter

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?

Author:Zulakis,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/26371071/laravel-blade-view-undefined-variable-errors
yy