diff --git a/routing.md b/routing.md index 9eafe2a93be..aaa5bd488c1 100644 --- a/routing.md +++ b/routing.md @@ -160,6 +160,19 @@ Once the pattern has been defined, it is automatically applied to all routes usi // Only executed if {id} is numeric... }); + +#### Encoded Forward Slashes + +By default, the Laravel routing component allows all characters except `/`. You must explicitly allow `/` to be part of your placeholder by specifying it with a `where` condition: + + Route::get('search/{search}', function ($search) { + return $search; + })->where('search', '.*'); + +Now when you submit a search with an encoded forward slash, it'll be decoded in the `$search` parameter. + +> {note} Please note that using encoded forward slashes is only possible for the last route segment. + ## Named Routes