Skip to content

Commit fe4fb84

Browse files
authored
Update Routes.php
1 parent a4e2ab5 commit fe4fb84

1 file changed

Lines changed: 29 additions & 8 deletions

File tree

system/Debug/Toolbar/Collectors/Routes.php

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,17 +132,38 @@ public function display(): array
132132
];
133133

134134
/*
135-
* Defined Routes
136-
*/
137-
$rawRoutes = $rawRoutes->getRoutes();
135+
* Defined Routes
136+
*/
138137
$routes = [];
138+
$methods = [
139+
'get',
140+
'head',
141+
'post',
142+
'patch',
143+
'put',
144+
'delete',
145+
'options',
146+
'trace',
147+
'connect',
148+
'cli',
149+
];
139150

140-
foreach ($rawRoutes as $from => $to)
151+
foreach ($methods as $method)
141152
{
142-
$routes[] = [
143-
'from' => $from,
144-
'to' => $to,
145-
];
153+
$raw = $rawRoutes->getRoutes($method);
154+
155+
foreach ($raw as $route => $handler)
156+
{
157+
// filter for strings, as callbacks aren't displayable
158+
if (is_string($handler))
159+
{
160+
$routes[] = [
161+
'method' => strtoupper($method),
162+
'route' => $route,
163+
'handler' => $handler,
164+
];
165+
}
166+
}
146167
}
147168

148169
return [

0 commit comments

Comments
 (0)