Ad

How To Store Form Data In Cookies OctoberCMS

- 1 answer

I have been searching through the docs and can't seem to find an example of how to store cookies. I have a simple form with two inputs that I would like to store the values of when the user returns to the website after a selected amount of time. While the docs are thorough I can seem to find working example of certain thing as in Laravel. Loving this CMS so far, any suggestions would be appreciated.

Ad

Answer

Use the Cookie service facade to read and write cookies.

https://octobercms.com/docs/services/request-input#cookies

Retrieving a cookie value

$value = Cookie::get('name');

Queue the cookie with the next page response

Cookie::queue($name, $value, $minutes);
Ad
source: stackoverflow.com
Ad