For anyone else that runs into this problem: It looks like this middleware is only included for the 'web' group. I was making API calls, and so the queue method was not available.
Jun 14, 2018
2
Level 3
Cookie::queue not attaching to response
Looking at the Laravel documentation, it appears you can attach a cookie to your next outgoing response by utilizing the Cookie::queue method. However, after trying to do so, it looks like the cookies are not being passed back:
Cookie::queue('client_cookie', 'test', 1000);
I have tried variations where you pass in a Cookie::make(), Cookie::Forever(), but none of these work.
However, simply doing the following appears to return a cookie:
return response('success', 200)->withCookie(Cookie::make('client_cookie', 'Testing', 1000));
Am I doing something incorrectly? I pulled in the Cookie class by using 'use Cookie;'
Is there some additional package I need to pull in?
Level 3
2 likes
Please or to participate in this conversation.