Answer Posted / sunil kumar
The withcookie() helper method is used to attach cookies.
The cookie generated with this method can be attached by calling withcookie() method with response instance.
By default, all cookies generated by Laravel are encrypted and signed so that they can't be modified or read by the client.
Example :
Route::get('/cookie',function(){
return response("Hello", 200)->header('Content-Type', 'text/html')
->withcookie('name','Virat Gandhi');
});
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain the service container and its advantages.
What is meant by Controller Middleware ?
what is meant by Global Middleware and Route Middleware ?
Why we use Laravel - Artisan Console ?
What is monolog library in laravel?
How can you display html with blade in laravel?
What do you mean by laravel mix?
What is routing and how, and what are the different ways to write it?
How to install valet?
How can we handle Error Handling in Laravel ?
What is reverse path check?
What are the Writing Gates and Policies ?
How to get cookies in laravel?
Where is the authentication configuration file is located in laravel?
How to get Retrieving a Cookie in Laravel ?