$page->increment($field) in multilang environment

Or as a custom method:

page::$methods['plusOne'] = function($page, $field, $by = 1, $max = null, $lang = null) {
  $page->update([
    $field => function($value) use($by, $max) {
      $new = (int)$value + $by;
      return ($max and $new >= $max) ? $max : $new;
    }
  ], $lang);
  return $page;
};

Use in template:

$page->plusOne('subscriptionscount', 1, null, 'nl');
1 Like