Laravel 路由报错:Variable name “innovation_entrepreneurship_activity” cannot be longer than 32 characters in route pattern “/admin/innovation-entrepreneurship-activities/{innovation_entrepreneurship_activity}”. Please use a shorter name.

这个错误说明已经很清晰了,就是路由定义太长了,超过了32个字符的限制,实际上这也不是 laravel 的问题,而是 symfony 的历史遗留问题,我们换个短点的字符串就可以了。

//导致错误的路由
$router->resource('innovation-entrepreneurship-activities','InnovationEntrepreneurshipActivityController');

//修改成短点的字符串后,不再报错。
$router->resource('ie-activities','InnovationEntrepreneurshipActivityController');