DEV Community

Dimitrios Desyllas
Dimitrios Desyllas

Posted on

How to update a postgres jsonb field using eloquent models

Hello may I have some help on this?

I have the following table in my postgresql database:

OOSama:
ID: AUTOINCREMENT BIGINT
NAME: VARCHAR(255)
NANI_WO_SUKI: JSONB

The NANI_WO_SUKI fields can contain the follwowing JSON:

{
  "kodomo":false,
  "dagashi":true,
  "kurosakikun":true
}

So I want to be able to update it without using raw SQL query. So I made the following model:

Top comments (0)