title: TokenMismatchException in VerifyCsrfToken.php line 67 - How to disable middleware and set that to be default
body: <p>I'm studying Laravel through videos. I made a view with only a textbox and a submit button. After I clicked submit button, I have TokenMismatchException in VerifyCsrfToken.php line 67 error.</p>
  
  <pre><code>TokenMismatchException in VerifyCsrfToken.php line 67:
  
  C:\xampp\htdocs\laravel_tut\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken.php line 67:
  in VerifyCsrfToken.php line 67
  at VerifyCsrfToken-&gt;handle(object(Request), object(Closure))
  at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
  at ShareErrorsFromSession-&gt;handle(object(Request), object(Closure))
  at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 62
  at StartSession-&gt;handle(object(Request), object(Closure))
  at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
  at AddQueuedCookiesToResponse-&gt;handle(object(Request), object(Closure))
  at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
  at EncryptCookies-&gt;handle(object(Request), object(Closure))
  at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
  at Pipeline-&gt;then(object(Closure)) in Router.php line 726
  at Router-&gt;runRouteWithinStack(object(Route), object(Request)) in Router.php line 699
  at Router-&gt;dispatchToRoute(object(Request)) in Router.php line 675
  at Router-&gt;dispatch(object(Request)) in Kernel.php line 246
  at Kernel-&gt;Illuminate\Foundation\Http\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
  at CheckForMaintenanceMode-&gt;handle(object(Request), object(Closure))
  at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
  at Pipeline-&gt;then(object(Closure)) in Kernel.php line 132
  at Kernel-&gt;sendRequestThroughRouter(object(Request)) in Kernel.php line 99
  at Kernel-&gt;handle(object(Request)) in index.php line 54
  </code></pre>
  
  <p>I have PostsController:</p>
  
  <pre><code>//PostsController
  &lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  
  use App\Http\Requests;
  
  class PostsController extends Controller
  {
      ...
  
      public function create()
      {
          //
          return view('posts.create');
      }
  
      public function store(Request $request)
      {
          //
          return $request-&gt;all();
      }
      ...
  }
  </code></pre>
  
  <p>routes.php:</p>
  
  <pre><code>Route::resource('/posts', 'PostsController');
  Route::group(['middleware'=&gt;['web']],function(){
  
  });
  </code></pre>
  
  <p>create.blade.php:</p>
  
  <pre><code>@extends('layouts.app')
  
  @section('content')
  
  &lt;form method="post" action="/posts"&gt;
      &lt;input type="text" name="title" placeholder="Enter title"&gt;
      &lt;input type="submit" name="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I googled and most solutions suggest adding:</p>
  
  <pre><code>&lt; meta name="csrf-token" content="{{ csrf_token() }}" /&gt;
  </code></pre>
  
  <p>but I didn't see the tutor add this line. I noticed that in his route:list, his middleware column's values are empty while mine are 'web'</p>
  
  <pre><code>$ php artisan route:list
  +--------+-----------+--------------------+---------------+----------------------------------------------+------------+
  | Domain | Method    | URI                | Name          | Action                                       | Middleware |
  +--------+-----------+--------------------+---------------+----------------------------------------------+------------+
  |        | GET|HEAD  | insert             |               | Closure                                      | web        |
  |        | POST      | posts              | posts.store   | App\Http\Controllers\PostsController@store   | web        |
  |        | GET|HEAD  | posts              | posts.index   | App\Http\Controllers\PostsController@index   | web        |
  |        | GET|HEAD  | posts/create       | posts.create  | App\Http\Controllers\PostsController@create  | web        |
  |        | DELETE    | posts/{posts}      | posts.destroy | App\Http\Controllers\PostsController@destroy | web        |
  |        | PUT|PATCH | posts/{posts}      | posts.update  | App\Http\Controllers\PostsController@update  | web        |
  |        | GET|HEAD  | posts/{posts}      | posts.show    | App\Http\Controllers\PostsController@show    | web        |
  |        | GET|HEAD  | posts/{posts}/edit | posts.edit    | App\Http\Controllers\PostsController@edit    | web        |
  +--------+-----------+--------------------+---------------+----------------------------------------------+------------+
  </code></pre>
  
  <p>I assume that if I can disable this middleware, the problem will be solved. However, I also didn't see the tutor do the disable step in any of his project, so I think he set it by default, so the middleware is always disabled in any project. Am I thinking the right way to fix this VerifyCsrfToken error? If so, how can I disabled middleware and set that to be default for other project? I'm using Laravel 5.2.39 and NetBeans IDE.</p>
  
  <p>This is the tutor's route:list</p>
  
  <p><a href="https://i.stack.imgur.com/Vqlvt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Vqlvt.png" alt="tutor&#39;s route:list"></a></p>