How to get Retrieving a Cookie in Laravel ?



How to get Retrieving a Cookie in Laravel ?..

Answer / rajani

Once we set the cookie, we can retrieve the cookie by cookie() method.
This cookie() method will take only one argument which will be the name of the cookie.
The cookie method can be called by using the instance of IlluminateHttpRequest.

Here is a sample code with explanation.

//’name’ is the name of the cookie to retrieve the value of
$value = $request->cookie('name');

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Laravel PHP Framework Interview Questions

What is meant by Forms in Laravel ?

1 Answers  


How can someone turn off csrf protection for a specific route?

0 Answers  


What is laravel framework?

0 Answers  


List the requirements to install valet?

0 Answers  


What is :: in laravel?

0 Answers  






How to create a laravel project using composer.

0 Answers  


How to use multiple or condition in laravel query?

0 Answers  


What is soft delete in laravel?

0 Answers  


How to use ajax in any form submission?

0 Answers  


What is service container in laravel?

0 Answers  


How to use aggregate functions in laravel query?

0 Answers  


Does wordpress use laravel?

0 Answers  


Categories