--- /dev/null
+<?php
+
+
+namespace Cubist\Backpack\app\Magic\Fields;
+
+class RolesPermissions extends Field
+{
+ protected $_adminType = 'checklist_dependency';
+
+ public function getDefinition()
+ {
+ $res = parent::getDefinition();
+ $res['field_unique_name'] = 'user_role_permission';
+ $res['name'] = ['roles', 'permissions'];
+ $res['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
+ ],
+ 'secondary' => [
+ 'label' => ucfirst(trans('backpack::permissionmanager.permission_singular')),
+ '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
+ ],
+ ];
+ return $res;
+ }
+}