英文:
Laravel Backpack issue adding route for CRUD controller
问题
关于我的项目,我正在使用Laravel后端,并安装了Backpack。目前,Backpack已经为我的Role模型生成了一个CRUD控制器,但我想要添加一个字段。由于这个CRUD控制器不在我的项目中,我无法编辑它。因此,我想为我的Role模型创建一个新的CRUD控制器。因此,我运行了以下命令:
php artisan backpack:crud role
当它要求输入类型时,我输入了 field
作为值。但当我运行时,我得到了一个异常,如下图所示:
我尝试使用不同的类型(如request等),但我得到了相同的异常。我还尝试更新Backpack,但这没有帮助。
英文:
For my project I'm using a Laravel backend with Backpack installed. Currently Backpack has generated a CRUD controller for my Role model but I want to add a field. Since this CRUD controller isn't in my project I can't edit this controller. So I wanted to create a new CRUD controller for my Role model. So I ran the following command:
php artisan backpack:crud role
When it asked for a type I gave field
as value. When I run this I get an exception as can be seen in the added image.
I tried using different types (request, etc.) but I got the same exception. I also tried updating Backpack, but this didn't help.
答案1
得分: 1
关于您的错误,请查看:https://github.com/Laravel-Backpack/community-forum/discussions/500
问题是您的 routes/backpack/custom.php
文件没有预期的结束行。
要在角色中添加字段等,您可以简单地创建一个新的 App/RoleController
,继承 Package/RoleController
,然后在 ServiceProvider 中绑定您的新控制器。
按照此处的说明操作:https://github.com/Laravel-Backpack/PermissionManager#customize-usercrudcontroller
祝好运
英文:
About your error please have a look at: https://github.com/Laravel-Backpack/community-forum/discussions/500
The problem is that your routes/backpack/custom.php
file does not have the expected end line.
To add fields etc in your roles, you can simply create a new App/RoleController extends Package/RoleController
and then bind your new controller in a ServiceProvider.
Follow the instructions here: https://github.com/Laravel-Backpack/PermissionManager#customize-usercrudcontroller
Cheers
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论