Beispiel #1
0
 private function createAclPermissions()
 {
     /** Permissions crud **/
     $permissionsCrud = new Permission();
     $permissionsCrud->name = 'permissions-crud';
     $permissionsCrud->display_name = 'Permissions Crud';
     $permissionsCrud->description = 'Create, update and delete Permissions';
     $permissionsCrud->save();
     /** roles crud **/
     $rolesCrud = new Permission();
     $rolesCrud->name = 'roles-crud';
     $rolesCrud->display_name = 'Roles Crud';
     $rolesCrud->description = 'Create, update and delete roles';
     $rolesCrud->save();
     return [$permissionsCrud, $rolesCrud];
 }
 public function getForSelect(Request $request, AclManager $acl)
 {
     if ($request->get('type') === 'role') {
         $permissionsModel = $acl->getPermissionsIdsForRole($request->get('model'));
     } else {
         $permissionsModel = $acl->getPermissionsIdsForUser($request->get('model'));
     }
     $permissions = Permission::whereNotIn('id', $permissionsModel)->get();
     return response()->json($permissions);
 }