Skip to content

Commit c3d1b1b

Browse files
committed
Compatibility. overtrue#192
1 parent 8f28eba commit c3d1b1b

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/ServiceProvider.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,17 @@ public function register()
8181
});
8282
}
8383

84-
$appConfigs = config('wechat.'.$name);
85-
foreach ($appConfigs as $key => $config) {
86-
$this->app->singleton("wechat.{$name}.{$key}", function ($laravelApp) use ($name, $key, $class) {
87-
$app = new $class(array_merge(config('wechat.defaults', []), config("wechat.{$name}.{$key}")));
84+
if (empty(config('wechat.'.$name.'default'))) {
85+
$accounts = [
86+
'default' => config('wechat.'.$name),
87+
];
88+
} else {
89+
$accounts = config('wechat.'.$name);
90+
}
91+
92+
foreach ($accounts as $account => $config) {
93+
$this->app->singleton("wechat.{$name}.{$account}", function ($laravelApp) use ($name, $account, $class) {
94+
$app = new $class(array_merge(config('wechat.defaults', []), config("wechat.{$name}.{$account}")));
8895
if (config('wechat.defaults.use_laravel_cache')) {
8996
$app['cache'] = new CacheBridge($laravelApp['cache.store']);
9097
}

0 commit comments

Comments
 (0)