Created
September 23, 2019 08:44
-
-
Save ijasxyz/5f15e2f0bf73b8e3d9967ef6ac6bd569 to your computer and use it in GitHub Desktop.
What is The Route(WTR)? (Generate route information from a given URI)
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
<?php | |
/* | |
* What is The Route(WTR)? (Generate route information from a given URI) | |
* */ | |
if (!function_exists('WTR')) { | |
function WTR($uri, $method = 'GET'){ | |
$request = request()->create($uri, $method); | |
$routes = app('router')->getRoutes()->match($request); | |
return collect($routes)->only([ | |
'uri', | |
'methods', | |
'action', | |
'isFallback', | |
'controller', | |
'defaults', | |
'wheres', | |
'parameters', | |
'parameterNames', | |
])->toArray(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment