We have a requirement that when we save a node that nodes title should be the site name. We used to do it in Drupal 7. But I was not able to find the proper method for it in Drupal 8.
This is what we tried:
$config = \Drupal::service('config.factory')->getEditable('system.site'); $config->set('system.site.name', "Demo Site"); $config->save();