Laravel Cookie
In the laravel, The Cookie is a type of mechanism. that used to store information on the client-side.
Create a cookie in laravel
If you want to create a cookie in laravel then you can create a cookie using the withCookie() method of a response instance of Illuminate\Http\Response class. so you can see our sample example.
//Create response
$response = new Illuminate\Http\Response('Hello World');
//set cookie with withCookie() method
$response->withCookie(cookie('name', 'value', $minutes));
//return the response
return $response;
Laravel get cookie value
If you want to get the cookie in laravel then you can get a cookie using the Cookie() method of a request instance of Illuminate\Http\Request class.
//enter the cookie name
$value = $request->cookie('name');