Skip to content

[13.x] Fix JSON path updates being lost after reading an Attribute accessor - #61962

Merged
taylorotwell merged 1 commit into
laravel:13.xfrom
xurshudyan:json-path-attribute-cast-cache
Oct 11, 2026
Merged

taylorotwell merged 1 commit into
laravel:13.xfrom
xurshudyan:json-path-attribute-cast-cache

Conversation

@xurshudyan

Copy link
Copy Markdown
Contributor

Follow-up to #61847, which fixed this for class casts. The same thing happens when the JSON column goes through an Attribute accessor that returns an object.

protected function settings(): Attribute
{
    return Attribute::make(
        get: fn ($value) => new Fluent(json_decode($value, true)),
        set: fn ($value) => json_encode($value),
    );
}

$user->settings->theme; // "light"

$user->update(['settings->theme' => 'dark']);

$user->settings->theme; // still "light", no UPDATE is sent

@taylorotwell
taylorotwell merged commit f618f79 into laravel:13.x Oct 11, 2026
64 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.

2 participants