Answer Posted / surbhi
The response can be attached to headers using the header() method.
We can also attach the series of headers as shown in the below sample code.
return response($content,$status)
->header('Content-Type', $type)
->header('X-Header-One', 'Header Value')
->header('X-Header-Two', 'Header Value');
Example : Route::get('/header',function(){
return response("Hello", 200)->header('Content-Type', 'text/html');
});
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
List out the plateforms laravel homestead supports?
Is laravel an mvc?
How to create Creating a Controller ?
What is factory in laravel?
How to clear complete cache in laravel?
Explain how can you write your own service provider in laravel?
Does laravel support caching?
What are laravel eloquent?
How install react js in laravel?
How to configure network interfaces in homestead?
What is service container?
How to launch vagrant box?
What are the Writing Gates and Policies ?
In laravel, what is guarded attribute in a model?
Which js framework is best with laravel?