src/Http/Controllers/RolesController.php
protected function getPermissionGroupIndex($groups)
    {
        $index = [];

        foreach ($groups as $key => $presence) {

            $permissions = $presence->permissions();

            if ( ! $permissions) {
                continue;
            }

            if ( ! is_array($permissions)) {
                $permissions = [ $permissions ];
            }

            foreach ($permissions as $permission) {
                $index[ $permission ] = $key;
            }
        }

        return $index;
    }
protected function getPermissionGroupIndex($groups)
    {
        $index = [];

        foreach ($groups as $key => $presence) {

            $permissions = $presence->permissions();

            if ( ! $permissions) {
                continue;
            }

            if ( ! is_array($permissions)) {
                $permissions = [ $permissions ];
            }

            foreach ($permissions as $permission) {
                $index[ $permission ] = $key;
            }
        }

        return $index;
    }
Returns an index for the group for each permission.

@param AclPresenceInterface[] $groups
@return string[]     associative: keyed by permission slug