title: Laravel Auth Middleware not Working for POST Route
body: <p>I have a simple form in my site and I want to check if the user is currently logged in before he can post the form. I have put auth middleware in the post route...</p>
  
  <pre><code>Route::post('test','SellController@test_mid')-&gt;middleware('auth');
  </code></pre>
  
  <p>My auth middleware...</p>
  
  <pre><code>&lt;?php
  
  public function handle($request, Closure $next, $guard = null)
  {
      if (Auth::guard($guard)-&gt;guest()) {
          if ($request-&gt;ajax() || $request-&gt;wantsJson()) {
              return response('Unauthorized.', 401);
          } else {
              return redirect()-&gt;guest('login');
          }
      }
  
      return $next($request);
  }
  </code></pre>
  
  <p>Here <strong>'login'</strong> redirects to my login page.</p>
  
  <p>The problem is after I hit the login button, the error is...</p>
  
  <blockquote>
    <p>MethodNotAllowedHttpException in RouteCollection.php line 219: 
    at RouteCollection->methodNotAllowed(array('POST')) in
    RouteCollection.php line 206</p>
  </blockquote>
  
  <p>Form...</p>
  
  <pre><code>{{ Form::open(array('url'=&gt;"/test")) }}=
      &lt;input type="submit" value="submit"&gt;
  {{ Form::close() }}
  </code></pre>
  
  <p>But if I set the auth middleware on a <strong>GET</strong> route, it works fine. In case of a <strong>GET</strong>, if I am logged out, it leads me to the login page. After I provide login credentials and hit the login button it leads me to the desired <strong>GET</strong> route.</p>