title: Laravel 5, unprocessable entity 422 error
body: <p>I am trying to validate the login form and display errors on the page. But i am getting a 422 error when i click on login. </p>
  
  <p>Any help would be appreciated.</p>
  
  <p>This is my handleLogin function that handles the processes when login button is clicked.</p>
  
  <pre><code>public function handleLogin(Request $request){
  
      /* validate user */
     $this-&gt;validate($request, User::$login_validation_rules);
  
      $data = $request-&gt;only('email', 'password');
      if(\Auth::attempt($data)){
      return redirect()-&gt;route('home');
      }
  
  return back()-&gt;withInput();
  }
  </code></pre>
  
  <p>The following is the routes.php</p>
  
  <pre><code>Route::get('/login', ['as' =&gt; 'login', 'uses' =&gt; 'LoginController@login']);
  Route::post('/handleLogin', ['as' =&gt; 'handleLogin', 'uses' =&gt; 'LoginController@handleLogin']);
  Route::get('/home', ['as' =&gt; 'home', 'uses' =&gt; 'UsersController@home']);
  Route::get('/logout', ['as' =&gt; 'logout', 'uses' =&gt; 'LoginController@logout']);
  Route::resource('users', 'UsersController', ['only' =&gt; ['create', 'store']]);
  </code></pre>
  
  <p>And the following is the login form.</p>
  
  <pre><code>@extends('master')
  
  @section('content')
  
  &lt;h2&gt; Login &lt;/h2&gt;
  @if(count($errors))
  &lt;div class="alert alert-danger"&gt;
      &lt;ul&gt;
          @foreach($errors-&gt;all() as $error)
              &lt;li&gt;{{ $error }}&lt;/li&gt;
          @endforeach
      &lt;/ul&gt;
  &lt;/div&gt;
  @endif
  
      {!! Form::open(array('route' =&gt; 'handleLogin')) !!}
  &lt;div class="form-group"&gt;
      {!! Form::label('email') !!}
      {!! Form::text('email', null, array('class' =&gt; 'form-control')) !!}
  &lt;/div&gt;
  &lt;div class="form-group"&gt;
    {!! Form::label('password') !!}
    {!! Form::password('password', array('class' =&gt; 'form-control')) !!}
  &lt;/div&gt;
  {!! Form::token() !!}
  {!! Form::submit('Login', array('class' =&gt; 'btn btn-default')) !!}
  {!! Form::close() !!}
  
  @stop
  </code></pre>