Skip to content

[6.x] Fix Eloquent user merge setting roles and groups as model attributes#14526

Merged
jasonvarga merged 1 commit into6.xfrom
elqouent-user-merge
Apr 21, 2026
Merged

[6.x] Fix Eloquent user merge setting roles and groups as model attributes#14526
jasonvarga merged 1 commit into6.xfrom
elqouent-user-merge

Conversation

@duncanmcclean
Copy link
Copy Markdown
Member

This pull request fixes an issue where calling merge() on an Eloquent user would cause a Column not found SQL error for roles and groups.

This was happening because merge() round-trips through data() — the getter injects roles and groups from their relationship tables, but the setter passes every key through set(), which assigns directly to the Eloquent model. When the model saves, it tries to write roles and groups columns that don't exist.

This PR fixes it by stripping roles and groups from the data before passing it back through the setter, since they're managed via their own relationship tables and should never be set as model attributes.

Fixes duncanmcclean/statamic-cargo#176

@jasonvarga jasonvarga merged commit 79cdda5 into 6.x Apr 21, 2026
18 checks passed
@jasonvarga jasonvarga deleted the elqouent-user-merge branch April 21, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cart Update merge groups & roles

2 participants