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

Does laravel prevent sql injection?

0 Answers  


How to get current route name?

0 Answers  


How to clear complete cache in laravel?

0 Answers  


How to enable maintenance mode in laravel 5?

0 Answers  


Explain the controllers in laravel?

0 Answers  


Explain what is mvc architecture?

0 Answers  


What are service providers?

0 Answers  


How to register a middleware in laravel 5?

0 Answers  


What is meant by Attaching Cookies ?

1 Answers  


How to make a custom validation rule in laravel?

0 Answers  


What is meant by Laravel - Localization ?

1 Answers  


What does csrf token in laravel 5?

0 Answers  


Categories