Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026
The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.
We’ve seen how to create static routes with Laravel.
Sometimes you want your routes to be dynamic.
This will be especially useful with databases, but let’s do an example without first.
In routes/web.php add an entry like this:
Route::get('test/{name}', function($name) {
return view('test', ['name' => $name]);
});
and in resources/views/test.blade.php write this code:
@if (isset($name))
Hello {{$name}}
@else
Test
@endif
Now if you navigate with your browser to the /test/flavio route, “flavio” is the $name parameter in the route, which is passed to the view, so you can print it in the Blade template:

Change the route parameter, the name in the HTML changes:

Lessons in this unit:
| 0: | Introduction |
| 1: | Getting started |
| 2: | ▶︎ Dynamic routes |
| 3: | Dynamic routes advanced |
| 4: | Non-web routes |
| 5: | Dynamic routes in Laravel |
| 6: | Introduction to Laravel |