在用 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的更多相关文章

  1. What are the differences between a pointer variable and a reference variable in C++?

    Question: I know references are syntactic sugar, so code is easier to read and write. But what are t ...

  2. 【ASP.NET MVC 牛刀小试】 URL Route

    例子引入 先看看如下例子,你能完全明白吗? using System; using System.Collections.Generic; using System.Linq; using Syste ...

  3. laravel route路由,视图和response和filter

    Laravel充分利用PHP 5.3的特性,使路由变得简单并富于表达性.这使得从构建API到完整的web应用都变得尽可能容易.路由的实现代码在 application/routes.php 文件. 和 ...

  4. Laravel之路由 Route::get/post/any、路由参数、过滤器、命名、子域名、前缀、与模型绑定、抛出 404 错误、控制器

    基本路由 应用中的大多数路都会定义在 app/routes.php 文件中.最简单的Laravel路由由URI和闭包回调函数组成. 基本 GET 路由 代码如下: Route::get('/', fu ...

  5. FreeBSD Set a Default Route / Gateway

    Task: View / Display FreeBSD Routing Table Use netstat command with -r option:$ netstat -r$ netstat ...

  6. ASP.NET Routing

    ASP.NET Routing Other Versions   ASP.NET routing enables you to use URLs that do not have to map to ...

  7. Log4j – Configuring Log4j 2 - Log4j 2的配置

    Configuration Inserting log requests into the application code requires a fair amount of planning an ...

  8. 【ASP.NET MVC系列】浅谈ASP.NET MVC 路由

    ASP.NET MVC系列文章 [01]浅谈Google Chrome浏览器(理论篇) [02]浅谈Google Chrome浏览器(操作篇)(上) [03]浅谈Google Chrome浏览器(操作 ...

  9. 【转】Code Your Own PHP MVC Framework in 1 Hour

      原文: https://www.codeproject.com/Articles/1080626/Code-Your-Own-PHP-MVC-Framework-in-Hour --------- ...

随机推荐

  1. Nginx的特性与核心类别及配置文件和模块详解

    1.root path 设置web资源路径,用于指定请求的根文档目录,从根开始匹配 root:root/URI 2.alias path 指定路径别名,只能用于location中,从最后一个/开始匹配 ...

  2. django分页功能

    采用django自带的Paginator功能 from django.core.paginator import Paginator food = foodInfo.objects.filter(fo ...

  3. LVM基本概念及工作原理

    LVM基本概念及工作原理 背景知识: 一直困惑于LVM,特地找资料查了查,终于对LVM的概念和工作原理有了深入的理解.接下来记录下.新的技术出来必定是为了改变现有的不足,所以LVM的出现是由于对现有磁 ...

  4. Java基础-考察JVM内部结构的常用工具介绍

    Java基础-考察JVM内部结构的常用工具介绍 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 我们可以通过jvisualvm.exe考察jvm内部结构.而jvisualvm.exe ...

  5. 记录一次nginx的upstream的配置信息

    nginx的upstream的配置信息 upstream qq.xiaoyu.cn { server 192.168.1.139:80 max_fails=3 fail_timeout=30s; se ...

  6. Nginx的alias的用法及与root的区别

    以前只知道Nginx的location块中的root用法,用起来总是感觉满足不了自己的一些想法.然后终于发现了alias这个东西. 先看toot的用法 location /request_path/i ...

  7. springSecurity初步认识和执行流程

    springSecurity是spring官方给我们提供的一个非常强大的一个安全框架.也是现在最受欢迎的安全框架,比shiro更强大 springSecurity主要工作原理是内置了许多过滤器,组成过 ...

  8. redis工具类 ----RedisPoolUtil

    这里介绍一下,这个工具类不是在分布式环境下来用的,就是我们平常使用的,单机状况下,为什么博主开头要这样强调呢?因为,之前见网上有些博友有这样封装的,也有RedisShardedPoolUtil 封装的 ...

  9. Request库学习

    0x00前言 这库让我爱上了python  碉堡! 开心去学了一些python,然后就来学这个时候神库~~ 资料来源:http://cn.python-requests.org/en/latest/u ...

  10. Spring RedisTemplate操作-注解缓存操作(11)

    @Service @CacheConfig(cacheNames="user") public class RedisAn { public Map<String, User ...