InterviewSolution
Saved Bookmarks
| 1. |
How to define routes in Laravel? |
|
Answer» Laravel ROUTES are defined in the routes file in routes/web.php for web application routes. Routes can be defined using Illuminate\Support\Facades\Route and calling its static methods such as to get, post, put, DELETE, etc. use Illuminate\Support\Facades\Route;Route::get('/home', function () { return 'Welcome to Home Sweet Home';});A typical closure route looks like the above, where we provide the URI and the closure function to execute when that route is accessed. Route::get('/hello', 'HomeController@INDEX');Another way is like above, we can directly give the controller name and the METHOD to call, this can again be RESOLVED using Service Container. |
|