title: Laravel CSRF error
body: <p>I am learning laravel and I have just created a middleware with a very little session work. but I am getting below error:</p>
  
  <blockquote>
    <p>FatalThrowableError in VerifyCsrfToken.php line 136: Call to a member
    function setCookie() on null</p>
  </blockquote>
  
  <p>Here is the middleware:</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Middleware;
  
  use Closure;
  
  class Adminlogin {
  
      public function handle($request, Closure $next) {
          echo 1;
          if (!$request-&gt;session()-&gt;has('userid')) {
              return view('admin.auth.login');
          }
          return $next($request);
      }
  
  }
  </code></pre>