gpt4 book ai didi

Laravel Nova - 指向资源页面的新星路径

转载 作者:行者123 更新时间:2023-12-03 19:32:11 25 4
gpt4 key购买 nike

我需要将 Nova 路径指向资源。这样当用户登录时,他将定向到该特定资源。

我已在 /config/nova.php 中更新了此路径:

'path' => '/crm/resources/clients' 

现在登录后,我可以看到更新的 URL。但该页面仍然是 Welcome Nova 页面。

对此有什么想法吗?

最佳答案

您可以创建自定义 AssetTool Hook 到 Vue 路由器。在我们的特定情况下,我们希望重定向到我们的自定义工具而不是资源或仪表板。创建工具会生成 tool.js文件,它允许您挂接到 vue-router。

从仪表板重定向到命名路由

router.beforeEach((to, from, next) => {
if (to.name == "dashboard.custom") {
next({
name: "reports" // Route added by our tool
});
} else {
next();
}
});
从仪表板重定向到资源索引
router.beforeEach((to, from, next) => {
if (to.name == "dashboard.custom") {
next({
name: "index",
params: {
resourceName: 'model' // replace with resource name
}
});
} else {
next();
}
});
备注 resourceName是索引路由中定义的动态段的名称。
Showing why resourceName is used as the property name in the code above

关于Laravel Nova - 指向资源页面的新星路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53337077/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com