Edited readme.md via GitHub
This commit is contained in:
parent
ecdd559ace
commit
cec583aafe
12
readme.md
12
readme.md
|
@ -129,7 +129,7 @@ ### Cleaner URLs
|
||||||
## Defining Routes
|
## Defining Routes
|
||||||
|
|
||||||
- [The Basics](#routes-basics)
|
- [The Basics](#routes-basics)
|
||||||
- [Route URI Parameters](#routes-parameters)
|
- [Route URI Wildcards](#routes-wildcards)
|
||||||
- [Route Filters](#route-filters)
|
- [Route Filters](#route-filters)
|
||||||
- [Named Routes](#routes-named)
|
- [Named Routes](#routes-named)
|
||||||
- [Organizing Routes](#routes-folder)
|
- [Organizing Routes](#routes-folder)
|
||||||
|
@ -162,20 +162,20 @@ ### The Basics
|
||||||
|
|
||||||
[Back To Top](#top)
|
[Back To Top](#top)
|
||||||
|
|
||||||
<a name="routes-parameters"></a>
|
<a name="routes-wildcards"></a>
|
||||||
### Route URI Parameters
|
### Route URI Wildcards
|
||||||
|
|
||||||
Laravel makes passing URI parameters to your route functions a breeze using the **(:num)** and **(:any)** place-holders:
|
You can pass URI segments to your route functions using the **(:num)** and **(:any)** wildcards:
|
||||||
|
|
||||||
'PUT /user/(:num)' => function($id) {}
|
'PUT /user/(:num)' => function($id) {}
|
||||||
|
|
||||||
'GET /user/(:any)/edit' => function($username) {}
|
'GET /user/(:any)/edit' => function($username) {}
|
||||||
|
|
||||||
Sometimes you may wish to make a parameter optional. You can do so by placing a **?** in parameter:
|
You may make segments optional by placing a **?** in the wildcard:
|
||||||
|
|
||||||
'GET /branch/(:any?)' => function($branch = 'master') {}
|
'GET /branch/(:any?)' => function($branch = 'master') {}
|
||||||
|
|
||||||
If you need more power and precision (or just want to be extra nerdy), you can even use regular expressions:
|
If you need more power and precision, you can even use regular expressions:
|
||||||
|
|
||||||
'GET /product/([0-9]+)' => function($id) {}
|
'GET /product/([0-9]+)' => function($id) {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue