问题描述
我制作了一个包含路由的 laravel 包,它是一个特殊的路由,可以捕获大量可能的 url.我不希望我的路由优先于主应用程序中声明的其他包或路由.如何确保我的路线是最后声明的路线?
I have made a laravel package which contains a route, it is a special route that catches a large number of possible urls. I don't want my route to take precedence over other packages or routes declared in the main application. How can I ensure that my route is the last route declared?
推荐答案
路由按照它们在 routes.php 中列出的顺序进行评估.只需确保这条路线是数组中的最后一条即可.
Routes are evaluated in the order that they are listed in routes.php. Simply making sure this route is the last one in the array should do it.
更新
我相信你可以在 App::before 过滤器中注册路由,它会在所有用户路由之后注册它.
I believe you could just register the route in the App::before filter, which would register it after all user routes.
这篇关于laravel 包中路由声明的顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!