Json column update eloquent

Posted 2 years ago by abhimanyusharma003

I'm trying to update json column using eloquent but is not working.

Not working

        User::whereId(1)->update([
                'settings->push_notifications->follow' => false,
            ]);

Somehow if I use DB class, it works.

Works

        DB::table('users')
            ->where('id', 1)
            ->update([
            'settings->push_notifications->follow' => false
        ]);

Is it so that laravel don't support update of json column using eloquent ?

Here is JSON what that I would like to update

{
  "push_notifications": {
    "follow": true,
    "comment": true
  }
}

Please sign in or create an account to participate in this conversation.