Answer Posted / nafees ahmad
Laravel provides several different ways to return response.
Response can be sent either from route or from controller.
The basic response that can be sent is simple string as shown in the below sample code.
This string will be automatically converted to appropriate HTTP response.
Example :
Step 1 - Add the following code to app/Http/routes.php file.
app/Http/routes.php
Route::get('/basic_response', function () {
return 'Hai to One and All';
});
Step 2 - Visit the following URL to test the basic response.
http://localhost:8000/basic_response
Step 3 - The output will appear as shown in your screen.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How to share sites with external world on valet?
How to set cookies in laravel?
What is a Retrieving Input ?
What is artisan in laravel?
Tell me how do I see all of the routes that are defined?
What is fillable attribute in a model?
How can I learn laravel fast?
How do I set up the eloquent relationships between the aforementioned comments and authors, including creating the schema design?
What do you mean by laravel dusk?
What is blade template engine?
Explain how to upgrade valet to valet 2.0?
What is csrf protection?
How to Redirecting to Controller Actions in Laravel ?
Explain reverse routing in laravel.
Explain how to enable multiple php versions in homestead?