src/Repositories/PermissionRepository.php
protected function filterEmptyGroups()
    {
        $remove = [];
        foreach ($this->permissionGroups as $key => $presence) {
            if ( ! $this->filterNestedEmptyGroups($presence)) {
                $remove[] = $key;
            }
        }
        $this->permissionGroups->forget($remove);

        return $this;
    }
protected function filterEmptyGroups()
    {
        $remove = [];
        foreach ($this->permissionGroups as $key => $presence) {
            if ( ! $this->filterNestedEmptyGroups($presence)) {
                $remove[] = $key;
            }
        }
        $this->permissionGroups->forget($remove);

        return $this;
    }
Removes any empty (permissionless) groups from the compiled ACL structure.

@return $this