Created
October 14, 2016 14:49
-
-
Save alfredoem/d46353577bd6f449823cfa766f303f0a to your computer and use it in GitHub Desktop.
Laravel/Lumen Tricks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get Routes Parameters | |
/** | |
* Get a given parameter from the route. | |
* | |
* @param $name | |
* @param null $default | |
* @return mixed | |
*/ | |
function route_parameter($name, $default = null) | |
{ | |
$routeInfo = app('request')->route(); | |
return array_get($routeInfo[2], $name, $default); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment