laravel 包中路由声明的顺序 [英] order of route declarations in laravel package

查看:18
本文介绍了laravel 包中路由声明的顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个包含路由的 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 包中路由声明的顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆