且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Laravel 5:成组的路由模型绑定

更新时间:2023-02-21 18:55:37

仅当我在数据库中没有ID为666的文章时,我才能重新创建此问题.

I was able to recreate this issue but only when I did not have an article with id of 666 in the database.

奇怪的是,当我没有路由绑定设置时,我没有遇到这个问题.

Strangely enough, I didn't come across that issue when I did not have my route binding setup.

尝试创建ID为666的文章,或将ID更改为您已有的文章,它应该可以工作.如果不是,则可能有另一条路由覆盖了该路由.运行命令php artisan route:list以获得所有路由的列表.如果要缓存路由,请确保也重新生成缓存.

Try creating an article with id of 666 or changing the id to an article you do have and it should work. If it does not, you may have another route overriding this one. Run the command php artisan route:list to get a list of all your routes. If you are caching routes, be sure to regenerate the cache as well.