Learn how to define and manage routes in Laravel applications.
This lesson contains a video that is currently hidden.
Routing is one of the fundamental concepts in Laravel. It's how your application responds to client requests to specific URIs.
The most basic Laravel routes accept a URI and a closure:
Route::get('/', function () {
return 'Hello World';
});
Sometimes you will need to capture segments of the URI within your route. You may do so by defining route parameters:
Route::get('user/{id}', function ($id) {
return 'User '.$id;
});
Named routes allow convenient generation of URLs or redirects for specific routes:
Route::get('user/profile', function () {
// Your logic here
})->name('profile');