Home

1 minute read

Laravel Cookies

Tony Lea

Laravel Cookies

Using Cookies in Laravel is super easy. Take a look at how we can use cookies in Laravel below:

First, Set a cookie you can use the following code:

$ref = 'my cookie value';
return redirect('/')->withCookie('ref', $ref);

Second, get a cookie value by doing the following:

$cookie = $request->cookie('ref');

And it's as easy as that. To learn more about laravel cookies you can visit the official documentation.

Additionally you can learn more about Laravel cookies by checking out this video: