Lesson list · Lesson 3 of 5

The Basics · Lesson 3 of 5

Routing Basics

How a URL reaches your code, and how to read values from it.

1 min 0 comments

A route connects a URL to the code that answers it. Parts of the URL in curly braces are passed along as parameters.

Route::get('/posts/{post}', [PostController::class, 'show']);

Route model binding

Because the parameter is named post and type-hinted as a model, Laravel looks up the post for you and returns a 404 page if it does not exist.

Discussion

Log in to join the conversation. Log in

No discussion here yet. Be the first to ask.