Skip to content

Instantly share code, notes, and snippets.

@alixcan
Last active September 29, 2021 08:22
Show Gist options
  • Save alixcan/935dacde15872b5d67ffec6226c25267 to your computer and use it in GitHub Desktop.
Save alixcan/935dacde15872b5d67ffec6226c25267 to your computer and use it in GitHub Desktop.
<?php
//dd($request->route());
/*
$routes = [];
foreach (\Route::getRoutes()->getIterator() as $route){
if (strpos($route->uri, 'api') !== false){
$routes[] = $route->uri;
}
}
dd($routes);
*/
/* $route_name = [];
foreach (\Route::getRoutes()->getRoutes() as $route) {
$action = $route->getAction();
if (array_key_exists('as', $action)) {
$route_name[] = $action['as'];
}
}
dd($route_name);*/
/*
$routes = collect(\Route::getRoutes())->map(function ($route) { return $route->uri(); });
return ($routes);
*/
/*
$routes = collect(\Route::getRoutes())->map(function ($route) { return $route->action; });
return ($routes);
*/
/* \Artisan::call('route:list');
return '<pre>'.\Artisan::output();
*/
/* $route_name = [];
foreach (\Route::getRoutes()->getRoutes() as $route) {
$action = $route->getAction();
if (array_key_exists('as', $action)) {
$route_name[] = $action['as'];
}
}
foreach ($route_name as $key => $value) {
echo $value . ' - ' . $key . '<br>';
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment