How to get Retrieving a Cookie in Laravel ?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is middleware in laravel?

585


what is Blade ?

1008


What is meant by Laravel - Ajax ?

993


What is the use of in laravel?

499


How will you explain events in laravel?

510






What does orm stand for?

595


Do you know what is http middleware?

499


How to install and start, stop mysql on valet?

532


List out some artisan commands?

494


What is design pattern in laravel?

500


Tell me what are the official packages provided by laravel?

522


What is meant by Attaching Headers ?

1177


What do you understand by reverse routing?

559


what is meant by CSRF Protection in Laravel ?

1201


Is any server permissions required for laravel?

546