Working with JSON Column Updates in Laravel

$affected = DB::table('users')
    ->where('id', 1)
    ->update(['options->enabled' => true]);
class ConfigurationController extends Controller
{
    public function updateUserSettings($userId, $section, $value)
    {
        return DB::table('users')
            ->where('id', $userId)
            ->update(["settings->config->$section" => $value])
            ? 'Settings updated successfully'
            : 'Update failed';
    }
}
 
// migration
Schema::create('users', function (Blueprint $table) {
    $table->id();
    $table->json('settings');
    $table->timestamps();
});