Laravel Cookie

Cookie::get('key');
Cookie::get('key', 'default');

Create a cookie that lasts for ever

Cookie::forever('key', 'value');
Create a cookie that lasts N minutes
Cookie::make('key', 'value', 'minutes');

Set a cookie before a response has been created

Cookie::queue('key', 'value', 'minutes');

Forget cookie

Cookie::forget('key');

Send a cookie with a response

$response = Response::make('Hello World');

Add a cookie to the response

$response->withCookie(Cookie::make('name', 'value', $minutes));

Leave a Reply

Your email address will not be published.