Here we will see how to set, get, delete cookies in laravel application. We will talk about how to set cookies in laravel and how to get cookies in laravel.
But firstly, we will see what are Cookies
Basically, Cookies are a small data file, which is stored in the remote browser and by the help of cookies tracking/identifying return users in web applications.
$cookie = Cookie::make($name, $value, $minutes, $path, $domain,$secure, $httpOnly);
Create and Set Cookies
$cookie = Cookie::make('name', 'value', 120);
We can also set cookies forever by using cookies::forever() method
$cookie = Cookie::forever('name', 'value');
$val = Cookie::get('cookieName');
$cookie = Cookie::forget('cookieName');
May this example help you