Skip to content

Commit 35e5c4d

Browse files
committed
fix: handle SerializableClosure in action column display
Routes using Laravel's SerializableClosure (e.g., the storage/{path} route from FilesystemServiceProvider) are not instances of \Closure, so the instanceof check falls through and the serialized closure object is displayed as a string. Use is_string() to check whether the action is a controller reference; anything else (Closure, SerializableClosure, etc.) displays as "Closure".
1 parent 557095c commit 35e5c4d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Http/Controllers/Api.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function getRoutes()
3232
'uri' => $route->uri,
3333
'as' => $routeName,
3434
'methods' => $route->methods,
35-
'action' => $route->action['uses'] instanceof \Closure ? 'Closure' : ($route->action['uses'] ?? ''),
35+
'action' => is_string($route->action['uses'] ?? '') ? ($route->action['uses'] ?? '') : 'Closure',
3636
'middleware' => $routeMiddleware,
3737
];
3838
})->values()->all();

0 commit comments

Comments
 (0)