Skip to content

Commit

Permalink
Update Routes.php
Browse files Browse the repository at this point in the history
  • Loading branch information
atishhamte authored Feb 22, 2020
1 parent a4e2ab5 commit fe4fb84
Showing 1 changed file with 29 additions and 8 deletions.
37 changes: 29 additions & 8 deletions system/Debug/Toolbar/Collectors/Routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,38 @@ public function display(): array
];

/*
* Defined Routes
*/
$rawRoutes = $rawRoutes->getRoutes();
* Defined Routes
*/
$routes = [];
$methods = [
'get',
'head',
'post',
'patch',
'put',
'delete',
'options',
'trace',
'connect',
'cli',
];

foreach ($rawRoutes as $from => $to)
foreach ($methods as $method)
{
$routes[] = [
'from' => $from,
'to' => $to,
];
$raw = $rawRoutes->getRoutes($method);

foreach ($raw as $route => $handler)
{
// filter for strings, as callbacks aren't displayable
if (is_string($handler))
{
$routes[] = [
'method' => strtoupper($method),
'route' => $route,
'handler' => $handler,
];
}
}
}

return [
Expand Down

0 comments on commit fe4fb84

Please sign in to comment.