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

In laravel, what is guarded attribute in a model?

0 Answers  


How much laravel experience do you have?

0 Answers  


What are middleware groups?

0 Answers  


How can I learn laravel fast?

0 Answers  


What does csrf token in laravel 5?

0 Answers  






How to stop valet?

0 Answers  


Write a code to upload a file in laravel 5?

0 Answers  


What is the best package to set up billing and subscription with stripe and braintree?

0 Answers  


What is a Restful Resource Controllers ?

0 Answers  


How many types of middleware are there in laravel?

0 Answers  


What is the difference between facades vs helper functions?

0 Answers  


How do I make all of my forms bootstrap opinionated?

0 Answers  


Categories