I used to the to send response with a cookie by this way:
return $response->withCookie(cookie()->forever('region', $region));
It works perfectly. But now I want to send a response with multiple cookies set, could anyone please give me some suggestion about that?
return $response
->withCookie(cookie()->forever('region', $region))
->withCookie(cookie()->forever('somethingElse', $somethingElse));
You can use Cookie queues to queue them, so that they will be automatically attached to the response when it is ready.
Cookie::queue(Cookie::forever('region', $region));
Cookie::queue(Cookie::forever('region2', $region2));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With