Skip to content

Instantly share code, notes, and snippets.

@ijasxyz
Created September 23, 2019 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ijasxyz/5f15e2f0bf73b8e3d9967ef6ac6bd569 to your computer and use it in GitHub Desktop.
Save ijasxyz/5f15e2f0bf73b8e3d9967ef6ac6bd569 to your computer and use it in GitHub Desktop.
What is The Route(WTR)? (Generate route information from a given URI)
<?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