Search code examples
phplaravellaravel-backpack

Laravel Backpack issue adding route for CRUD controller


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.

CLI backpack exception

I tried using different types (request, etc.) but I got the same exception. I also tried updating Backpack, but this didn't help.


Solution

  • 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