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

Explain faker in laravel.

0 Answers  


What does double quotation mean?

0 Answers  


How to add multiple and conditions in laravel query?

0 Answers  


What is factory in laravel?

0 Answers  


How to use stored procedures in laravel?

0 Answers  


What is Named Routes.

0 Answers  


What is lts in laravel?

0 Answers  


What is the boot method?

0 Answers  


Why laravel is the best framework?

0 Answers  


In which directory laravel configartion files are kept.

0 Answers  


What do you know about php artisan?

0 Answers  


How to configure network interfaces in homestead?

0 Answers  


Categories