Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.3] Updating JSON returns data as "meta->area" instead of meta : {area : ...} #16213

Closed
lukepolo opened this issue Nov 1, 2016 · 4 comments

Comments

@lukepolo
Copy link
Contributor

lukepolo commented Nov 1, 2016

  • Laravel Version: 5.3.21
  • PHP Version: 7.0.12
  • Database Driver & Version: MySQL / 5.7.13-0ubuntu0.16.04.2

Description:

When updating JSON

    public function update(Request $request, $id)
    {
        $program = Program::findOrFail($id)->fill([
            'meta->area' => 'new value'
        ]);

        $program->save();

        return response()->json($program);
    }

Returns

    {
        ....
        meta : {area : 'old value'},
        meta->area : "new area"
        ....
    }

It is correctly updating just not replacing the value correctly upon return.

Steps To Reproduce:

    public function update(Request $request, $id)
    {
        $program = Program::findOrFail($id)->fill([
            'meta->area' => 'new value'
        ]);

        $program->save();

        return response()->json($program);
    }

Look at the json value returning .

@jhoff
Copy link
Contributor

jhoff commented Nov 2, 2016

I'm pretty sure that meta->area is the wrong syntax. Are you meaning to use dot notation?

meta.area ?

@lukepolo
Copy link
Contributor Author

lukepolo commented Nov 2, 2016

https://laravel.com/docs/5.3/queries#updating-json-columns

Docs say otherwise

On Wednesday, November 2, 2016, Jordan Hoff notifications@github.com
wrote:

I'm pretty sure that meta->area is the wrong syntax. Are you meaning to
use dot notation? meta.area ?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#16213 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AB-I7AmmhtjKfQZ5ryXX3lZbv_R9Lcseks5q6CVugaJpZM4KmWbJ
.

@themsaid
Copy link
Member

themsaid commented Nov 2, 2016

@lukepolo working on a fix.

@jhoff
Copy link
Contributor

jhoff commented Nov 2, 2016

Huh... TIL. Apologies.

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

No branches or pull requests

3 participants