create json inside json in DB

  laravel, php

I’m trying to update a field in JSON column DB.
sometimes I have data inside and if I don’t have I would like to insert according to the where condition.

Home::query()->where("door", "3")->update(["a->b->c" => $data]);

Eventually I want that the data at the db will be {"b":{"c":"data"}}
a is the column name

I’m trying to avoid using json_encode()

Source: Ask PHP

LEAVE A COMMENT