Skip to content

users_count on UserGroup does not include users assigned via primary_group #617

Description

@Rike-cz

The users_count relation on UserGroup is defined as a belongsToMany count against the users_groups pivot table:

'users_count' => [
    User::class,
    'table' => 'users_groups',
    'count' => true
]

However, the primary_group relationship is a separate belongsTo using a primary_group_id foreign key stored directly on the users table. As a result, users whose only group membership is through primary_group_id — which includes every user created through the default registration flow — are not counted in the users_count column displayed in the backend UserGroups list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions