Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

fardeen7337's avatar

Laravel backpack ( permission manager )

Hi Laracasts Community,

I'm working on a Laravel project using Backpack and the Backpack PermissionManager package. I'm encountering a couple of issues related to field configurations in Backpack.

I can't do changing in the Roles table because it's access from vendor folder

checklist_dependency Field: I need to filter roles to show only specific ones (e.g., roles with the name != 'super admin')

[
                // two interconnected entities
                'label' => trans('backpack::permissionmanager.user_role_permission'),
                'field_unique_name' => 'user_role_permission',
                'type' => 'checklist_dependency',
                'name' => 'roles,permissions',
                'subfields' => [
                    'primary' => [

                        'label' => trans('backpack::permissionmanager.roles'),
                        'name' => 'roles', // the method that defines the relationship in your Model
                        'entity' => 'roles', // the method that defines the relationship in your Model
                        'entity_secondary' => 'permissions', // the method that defines the relationship in your Model
                        'attribute' => 'name', // foreign key attribute that is shown to user
                        'model' => config('permission.models.role'), // foreign key model
                        'pivot' => true, // on create&update, do you need to add/delete pivot table entries?]
                        'number_columns' => 3, //can be 1,2,3,4,6
                        'options' => function ($query){
                            $query->where('name','!=' ,'super admin');
                        },

                    ],
                    'secondary' => [
                        'label' => mb_ucfirst(trans('backpack::permissionmanager.permission_plural')),
                        'name' => 'permissions', // the method that defines the relationship in your Model
                        'entity' => 'permissions', // the method that defines the relationship in your Model
                        'entity_primary' => 'roles', // the method that defines the relationship in your Model
                        'attribute' => 'name', // foreign key attribute that is shown to user
                        'model' => config('permission.models.permission'), // foreign key model
                        'pivot' => true, // on create&update, do you need to add/delete pivot table entries?]
                        'number_columns' => 3, //can be 1,2,3,4,6
                    ],
                ],
            ],

I have added this line but getting error htmlspecialchars(): Argument #1 ($string) must be of type string, Closure given

  'options' => function ($query){
                            $query->where('name','!=' ,'super admin');
                        },

0 likes
0 replies

Please or to participate in this conversation.