zoukankan      html  css  js  c++  java
  • Route pattern cannot reference variable name more than once

    在用 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 最后的那个单词作为变量,所以出现了报错日志中的变量名重复的问题。

  • 相关阅读:
    [Redis]在.NET平台下的具体应用
    [Redis]在Windows下的下载及安装
    【重读MSDN之ADO.NET】ADO.NET连接
    贪心
    树状数组
    并查集
    模拟
    kruskal
    树链剖分
    匈牙利算法
  • 原文地址:https://www.cnblogs.com/sgm4231/p/10191187.html
Copyright © 2011-2022 走看看