what is json in javascript

How to use JSON operations in Laravel Query builder?

Sometimes we are dealing with JSON columns in our tables. We can easily select and update records on the bases of JSON values in any columns. For example, here in our leads table we have options column. We can select records on the bases of any child in that column in JSON form.

$verifiedLeads = DB::table( 'leads' )
                ->where( 'options->is_verified', '=',true )

We can also update any child in JSON column.

DB::table( 'leads' )->update( ['options->is_verified' => true ]);

I hope now you can use JSON queries in Laravel query builder. It is very convenient and easy to use with great power. If you have any questions please leave a comment. We appreciate that. Enjoy learning.