我试图通过使用此代码块来获取路径
function addMetaAlpha<A extends { type: string }>(action: () => A, alpha: string) {
return function (): A & MetaAlpha {
let act = action();
return Object.assign(act, {
meta: {
alpha
}
})
}
}
var metaAct1 = addMetaAlpha(action1, "DD"); // () => Action1 & MetaAlpha
var metaAct2 : () => FluxStandardAction<'one', { alpha: string }> = metaAct1; // Is is assignable to the interface if we need it to be;
但它会在网络浏览器上返回
public function routeSave(RouteCollection $routes){
$routeCollection = $routes->getRoutes();
dd($routes);
}
然后我怎样才能正确得到结果呢?
答案 0 :(得分:1)
use Illuminate\Support\Facades\Route;
public function routeSave(){
$routeCollection = Route::getRoutes();
dd($routeCollection);
}
更新回复评论:
$routeNames = [];
foreach ($routeCollection as $route){
$routeNames[] = $route->getName();
}