Laravel Routing Basics

15 min

Learn how to define and manage routes in Laravel applications.

Video Lesson

Video Hidden

This lesson contains a video that is currently hidden.

Introduction to Routing

Routing is one of the fundamental concepts in Laravel. It's how your application responds to client requests to specific URIs.

Basic Routing

The most basic Laravel routes accept a URI and a closure:

Route::get('/', function () {
    return 'Hello World';
});

Route Parameters

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

Named routes allow convenient generation of URLs or redirects for specific routes:

Route::get('user/profile', function () {
    // Your logic here
})->name('profile');

Lesson Attachments

Routing Cheat Sheet.pdf

124 KB • PDF

Download

Example Routes.zip

2.1 MB • ZIP Archive

Download
Previous Lesson
Next Lesson