Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ If your route has dependencies that you would like the Laravel service container

Occasionally you may need to specify a route parameter that may not always be present in the URI. You may do so by placing a `?` mark after the parameter name. Make sure to give the route's corresponding variable a default value:

Route::get('/user/{name?}', function (string $name = null) {
Route::get('/user/{name?}', function (?string $name = null) {
return $name;
});

Route::get('/user/{name?}', function (string $name = 'John') {
Route::get('/user/{name?}', function (?string $name = 'John') {
return $name;
});

Expand Down