0

I get this error exception in Laravel 5.2. I am trying to access auth/login

  • Undefined variable: errors
  • Undefined variable: errors (View: C:\xampp\htdocs\tutorials\laravel\resources\views\auth\login.blade.php)

This is my routes.php

Route::group(['middleware' => ['web']], function () {

    Route::get('/', function () {
        return view('welcome');
    });


    Route::get('about' , 'PagesController@about');

    Route::resource('articles' , 'ArticlesController');

    Route::controllers([
        'auth' => 'Auth\AuthController',
        'password' => 'Auth\PasswordController'
    ]);

});

This is auth/login.blade.php

@extends('app')

@section('content')
<div class="container-fluid">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="panel panel-default">
                <div class="panel-heading">Login</div>
                <div class="panel-body">
                    @if (count($errors) > 0)
                        <div class="alert alert-danger">
                            <strong>Whoops!</strong> There were some problems with your input.<br><br>
                            <ul>
                                @foreach ($errors->all() as $error)
                                    <li>{{ $error }}</li>
                                @endforeach
                            </ul>
                        </div>
                    @endif

                    <form class="form-horizontal" role="form" method="POST" action="{{ url('/auth/login') }}">
                        {!! csrf_field() !!}

                        <div class="form-group">
                            <label class="col-md-4 control-label">E-Mail Address</label>
                            <div class="col-md-6">
                                <input type="email" class="form-control" name="email" value="{{ old('email') }}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-4 control-label">Password</label>
                            <div class="col-md-6">
                                <input type="password" class="form-control" name="password">
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-4">
                                <div class="checkbox">
                                    <label>
                                        <input type="checkbox" name="remember"> Remember Me
                                    </label>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-4">
                                <button type="submit" class="btn btn-primary">Login</button>

                                <a class="btn btn-link" href="{{ url('/password/email') }}">Forgot Your Password?</a>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
4
  • show the login code? and on which line you think problem arises Commented Feb 20, 2016 at 16:47
  • @Elliot, chow code in C:\xampp\htdocs\tutorials\laravel\resources\views\auth\login.blade.php Commented Feb 20, 2016 at 16:53
  • your question is similar as this question so i thing you find solution from here. Commented Feb 20, 2016 at 17:17
  • check your Login Controller & pass $error variable to View. :-) Commented Jan 11, 2017 at 7:37

1 Answer 1

1
    protected $middleware = [ 

           \Illuminate\Session\Middleware\StartSession::class,          
           \Illuminate\View\Middleware\ShareErrorsFromSession::class, 

   ];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.