If every user has is own different value then yes the database would be my preference here
Feb 23, 2019
7
Level 3
Dynamic configuration in service provider
How would I best dynamically update the configuration used in a service provider? for example, if I have an API key for user1, API key for user2 running through the same service provider to connect to an external API service?
for example:
public function register()
{
// Grab config
$config = $this->app->config->get('xero.config');
$this->app->bind('XeroPrivate', function () use ($config) {
return new \XeroPHP\Application\PrivateApplication($config);
});
...
I effectively need to be able to switch out the values inside xero.config for different users. Ideally I would use the same service provider and just update the config file prior to instantiating the service provider, but guess I could also store credentials in the database if needed.
Please or to participate in this conversation.