Update MySQL JSON column fields in Laravel

If you have a JSON column in your migrations, and you are looking to update the value of one of its fields. Here is how you can do it


$booking->update([
            'stripePayment->paymentStatus' => 'completed',
 ]);

For this to work you should be on MySQL v 5.7 + and also if you are using $fillable property to mark the fillable fields in the model, then you should add stripePayment->paymentStatus in the fillable array.
Otherwise you could just add the empty guarded property.

Site Footer