title: Laravel set cookie not working
body: <p>I have the following code in a custom middleware:</p>
  
  <pre class="lang-php prettyprint-override"><code>public function handle($request, Closure $next)
  {
      if($request-&gt;hasCookie('uuid')) {
          return $next($request);    
      }
  
      $uuid = 99;
      $response = $next($request);
      return $response-&gt;withCookie(cookie()-&gt;forever('uuid', $uuid));
  
  }
  </code></pre>
  
  <p>I have registered the middleware in the app.php file, but cookies is still not being written. Please can anyone help. Additionally can this above be run as a singleton, so that it is executed once on app start?</p>
  
  <p>Thanks</p>