I have been using drawmyattention for integrating my laravel code with xero, we get data from clients database and add it into our CRM. Recently, we got 2nd client who also wanted to integrate with Xero system, the problem i am facing is to change client (organization) i need to change following in config file
Consumer key consumer secret and RSA encryption
But when i change these values in config/xero/config.php file dynamically, since the drawmyattention vendors providers have already been loaded they do not get new values, instead they stick with old values in config file.
I used
config('xero.config.oauth', new array(values))
I can log and see values have changed but when i make connection call it gets data from client 1 and with further logging i came to know that new config values are not progating to providers that have been loaded before.
I tried to create my own defered service provider following
https://laravel.com/docs/5.2/providers
with no luck.
Kind of stuck whereas everything else is working fine just can't switch xero organizations at runtime due to this reason.
The answer in link also talks about same issue but still does could not solve Laravel dynamic config settings
When i create my own
class XeroDefferedProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->app->bind('DrawMyAttention\XeroLaravel\Facades\XeroPrivate', function()
{
return new XeroPrivate();
});
}
public function provides()
{
return ['DrawMyAttention\XeroLaravel\Facades\XeroPrivate'];
}
}
I get error that XeroPrivate class does not exists..
and I am also confused between using 'DrawMyAttention\XeroLaravel\Facades\XeroPrivate' or 'DrawMyAttention\XeroLaravel\Providers\XeroServiceProvider'
as later itself is a provider and i think since i need to declare object i need to use facades but ahh i am no pro in laravel.