title: Laravel creating non-encrypted cookie value on ajax response
body: <p>I set a cookie on ajax response call like this:</p>
  
  <p><code>return response($response, 200)-&gt;cookie('xid', $token, 2*24*60);</code></p>
  
  <p>The above creates a cookie like this (which is the token value, raw, non-encrypted):
  <a href="https://i.stack.imgur.com/XWMAP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XWMAP.png" alt="enter image description here"></a></p>
  
  <p>You can see this when running this code in the view:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          var tid = "{{ Cookie::get('xid') }}";
          var tid = "{{ $_COOKIE['xid'] }}";
  &lt;/script&gt;
  </code></pre>
  
  <p>I get the following output:</p>
  
  <p><a href="https://i.stack.imgur.com/XDiIf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XDiIf.png" alt="enter image description here"></a></p>
  
  <p>If I check the "laravel_session" cookie instead, the output is correct (it's encrypted):
  <a href="https://i.stack.imgur.com/TNQfA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TNQfA.png" alt="enter image description here"></a></p>
  
  <p>Any ideas why the <code>xid</code> cookie is not being encrypted? There are no exceptions in the middleware.</p>