You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: routing.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -197,11 +197,11 @@ If your route has dependencies that you would like the Laravel service container
197
197
198
198
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:
199
199
200
-
Route::get('/user/{name?}', function (string $name = null) {
200
+
Route::get('/user/{name?}', function (?string $name = null) {
201
201
return $name;
202
202
});
203
203
204
-
Route::get('/user/{name?}', function (string $name = 'John') {
204
+
Route::get('/user/{name?}', function (?string $name = 'John') {
0 commit comments