首页 > 其他 > 详细

Route pattern cannot reference variable name more than once

时间:2018-12-28 16:32:27      阅读:154      评论:0      收藏:0      [点我收藏+]

在用 Laravel Backpack 写一个定制化的 CRUD 页面。例如,一个指定店铺所拥有的商品的 CRUD 页面。

起初路由我是这样写的

CRUD::resource(‘products-of-store/{store_id}‘, ‘ProductCrudController‘);

报错

Route pattern "/products-of-store/{store_id}/{{store_id}}" cannot reference variable name "store_id" more than once.

解决方法,Route 调整为

CRUD::resource(‘store/{store_id}/products‘, ‘ProductCrudController‘);

即,Route 的最后设置为一个非变量。

出错的原因

我觉得是 resource 会自动将 route 最后的那个单词作为变量,所以出现了报错日志中的变量名重复的问题。

Route pattern cannot reference variable name more than once

原文:https://www.cnblogs.com/sgm4231/p/10191187.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!