title: Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException No message Laravel 5.5
body: <p>This is doing my head in. I'm getting this error when trying to login from a form:</p>
  
  <blockquote>
    <p>Symfony \ Component \ HttpKernel \ Exception \ </p>
    
    <p>MethodNotAllowedHttpException </p>
    
    <p>No message</p>
  </blockquote>
  
  <p>LoginController.php</p>
  
  <pre><code>&lt;?php
  namespace App\Http\Controllers;
  use App\Http\Controllers\Controller;
  use Illuminate\Foundation\Auth\AuthenticatesUsers;
  use Illuminate\Http\Request;
  use Illuminate\Support\Facades\Auth;
  class LoginController extends Controller
  {
      use AuthenticatesUsers;
      protected $username = 'username';
      protected $redirectTo = '/dashboard';
      protected $guard = 'web';
      public function getLogin()
      {
          if (Auth::guard('web')-&gt;check())
          {
              return redirect()-&gt;route('dashboard');
          }
          return view('login');
      }
      public function postLogin(Request $request)
      {
          $auth = Auth::guard('web')-&gt;attempt(['username' =&gt; $request-&gt;username, 'password' =&gt; $request-&gt;password, 'active' =&gt; 1]);
          if ($auth)
          {
              return redirect()-&gt;route('dashboard');
          }
          return redirect()-&gt;route('/');
      }
      public function getLogout()
      {
          Auth::guard('web')-&gt;logout();
          return redirect()-&gt;route('/');
      }
  }
  </code></pre>
  
  <p>The following route when i submit a form is working fine.</p>
  
  <pre><code>Route::get('/', ['as' =&gt; '/', 'uses' =&gt; 'LoginController@getLogin']);
  Route::get('/login', ['as' =&gt; 'login', 'uses' =&gt; 'LoginController@getLogin']);
  
  Route::group(['middleware' =&gt; ['autheticates', 'roles']], function (){
      Route::get('/logout', ['as' =&gt; 'logout', 'uses' =&gt; 'LoginController@getLogout']);
      Route::get('/dashboard', ['as' =&gt; 'dashboard', 'uses' =&gt; 'DashboardController@dashboard']);
  });
  </code></pre>
  
  <p>Middleware/Autheticates.php</p>
  
  <pre><code>class Autheticates
  {
      public function handle($request, Closure $next, $guard = 'web')
      {
          if (!Auth::guard($guard)-&gt;check())
          {
              return redirect()-&gt;route('/');
          }
          return $next($request);
      }
  }
  </code></pre>
  
  <p>Middleware/Roles.php</p>
  
  <pre><code>class Roles
  {
      public function handle($request, Closure $next)
      {
          $roles = $this-&gt;getRequiredRoleForRoute($request-&gt;route());
          if ($request-&gt;user()-&gt;hasRole($roles) || $roles){
              return $next($request);
          }
          return redirect()-&gt;route('noPermissions');
      }
      private function getRequiredRoleForRoute($route)
      {
          $actions = $route-&gt;getAction();
          return isset($actions['roles']) ? $actions['roles'] : null;
      }
  }
  </code></pre>
  
  <p>login.blade.php</p>
  
  <pre><code>&lt;form class="login-form" action="{{ route('login') }}" method="post"&gt;
      {{ csrf_field() }}
      &lt;div class="login-wrap"&gt;
          &lt;p class="login-img"&gt;&lt;i class="icon_lock_alt"&gt;&lt;/i&gt;&lt;/p&gt;
          &lt;div class="input-group"&gt;
              &lt;span class="input-group-addon"&gt;&lt;i class="icon_profile"&gt;&lt;/i&gt;&lt;/span&gt;
              &lt;input type="text" name="username" class="form-control" placeholder="Username" autofocus&gt;
          &lt;/div&gt;
          &lt;div class="input-group"&gt;
              &lt;span class="input-group-addon"&gt;&lt;i class="icon_key_alt"&gt;&lt;/i&gt;&lt;/span&gt;
              &lt;input type="password" name="password" class="form-control" placeholder="Password"&gt;
          &lt;/div&gt;
          &lt;label class="checkbox"&gt;
              &lt;input type="checkbox" value="remember-me"&gt; Remember me
              &lt;span class="pull-right"&gt; &lt;a href="#"&gt; Forgot Password?&lt;/a&gt;&lt;/span&gt;
          &lt;/label&gt;
          &lt;button class="btn btn-primary btn-lg btn-block" type="submit"&gt;Login&lt;/button&gt;
          &lt;button class="btn btn-info btn-lg btn-block" type="reset"&gt;Signup&lt;/button&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/06tv6.png" rel="noreferrer"><img src="https://i.stack.imgur.com/06tv6.png" alt="Error Image"></a></p>