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 create custom library in laravel?
What are the directory structure of laravel 5.8?
Define hashing in laravel.
What is views in laravel?
Tell us have you used lumen before?
What is database migration in laravel? How to use this?
What is database seeding in laravel?
What are laravel contract’s?
What route model binding?
What is route parameters in laravel?
Laravle supports which databases?
How to install laravel via composer?
What is the use of dd() function?
what is implementation measures in CSRF Protection ?
Do you know what is php artisan. List out some artisan commands?