Skip to content

[6.x] Fix Eloquent user data setting roles and groups as model attributes - #15125

Merged
jasonvarga merged 1 commit into
statamic:6.xfrom
lazerg:fix/issue-15124-eloquent-user-data-roles
Aug 5, 2026
Merged

[6.x] Fix Eloquent user data setting roles and groups as model attributes#15125
jasonvarga merged 1 commit into
statamic:6.xfrom
lazerg:fix/issue-15124-eloquent-user-data-roles

Conversation

@lazerg

@lazerg lazerg commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Running php please migrate-dates-to-utc on a site with Eloquent users fails with SQLSTATE[42S22]: Column not found: 1054 Unknown column 'roles' in 'field list'.

The command reads a user's data, converts the date fields, then writes the whole array back through data(). The getter injects roles and groups from their relationship tables, but the setter passes every key through set(), which assigns them straight to the Eloquent model, so the save tries to write columns that don't exist. merge() was fixed the same way in #14526, and UsersController already strips both keys before calling data().

The same crash happens anywhere else data is round-tripped through the setter, such as renaming an asset, which goes through AssetReferenceUpdater.

Fixes #15124

@jasonvarga
jasonvarga merged commit 6099a8d into statamic:6.x Aug 5, 2026
20 checks passed
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.

Converting dates on an eloquent site throws an error

2 participants