title: How to bind configuration value Laravel service provider on run-time?
body: <p>I have created custom service provider which extends XeroServiceProvide, Basically, I have multiple Xero Account and I want to change two configuration params value runtime <strong>consumer_key</strong> and <strong>consumer_secret</strong>. Is there a quick way. I have checked <a href="https://laravel.com/docs/5.6/container#contextual-binding" rel="noreferrer">Service Container</a> contextual binding but don't know how to use. </p>
  
  <pre><code>&lt;?php
  
  namespace App\Providers;
  
  use Illuminate\Support\ServiceProvider;
  use DrawMyAttention\XeroLaravel\Providers\XeroServiceProvider;
  
  class CustomXeroServiceProvider extends XeroServiceProvider
  {
      private $config = 'xero/config.php';
  
      /**
       * Bootstrap the application services.
       *
       * @return void
       */
      public function boot()
      {
          //
          parent::boot();
      }
  
      /**
       * Register the application services.
       *
       * @return void
       */
      public function register($configParams = [])
      {
          parent::register();
  
          if(file_exists(config_path($this-&gt;config))) {
              $configPath = config_path($this-&gt;config);
              $config = include $configPath;
          }
  
          $this-&gt;app-&gt;bind('XeroPrivate', function () use ($config,$configParams) {
  
              if(is_array($configParams) &amp;&amp; count($configParams) &gt; 0){
                  if(isset($configParams['consumer_key'])){
                      $config['oauth']['consumer_key']    = $configParams['consumer_key'];
                  }
  
                  if(isset($configParams['consumer_secret'])){
                      $config['oauth']['consumer_secret'] = $configParams['consumer_secret'];
                  }
              }
              return new \XeroPHP\Application\PrivateApplication($config);
          });
  
      }
  }
  </code></pre>
  
  <p>From Controller I tried changing value like this but bind params not changing dynamically</p>
  
  <pre><code>foreach($centers as $center) {
  
   config(['xero.config.oauth.consumer_key' =&gt; $center-&gt;consumer_key]);
   config(['xero.config.oauth.consumer_secret' =&gt; $center-&gt;consumer_secret]);
  }
  </code></pre>
  
  <p><strong>Update 2</strong></p>
  
  <p>Is there a way I can rebind service container after updating config file values or somehow i can refresh service provider binding?</p>
  
  <pre><code>config(['xero.config.oauth.consumer_key' =&gt; 'XXXXXXX']);
  config(['xero.config.oauth.consumer_secret' =&gt; 'XXXXXX']);
  // rebind Service provider after update
  </code></pre>