code
This commit is contained in:
parent
47edd9968b
commit
438147dbd8
|
@ -21,13 +21,14 @@ class ClientServiceProvider extends BaseServiceProvider
|
||||||
if (!is_array($config)) {
|
if (!is_array($config)) {
|
||||||
throw new RpcServerException("Application's Rpc Client Config Undefind", 500);
|
throw new RpcServerException("Application's Rpc Client Config Undefind", 500);
|
||||||
}
|
}
|
||||||
$this->app->singleton('rpc', function () use ($config) {
|
$client = new Client($config);
|
||||||
return new Client($config);
|
$this->app->singleton('rpc', function () use ($client) {
|
||||||
|
return $client;
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach ($config['client'] as $k => $item) {
|
foreach ($config['client'] as $k => $item) {
|
||||||
$this->app->singleton('rpc.' . $k, function () use ($k) {
|
$this->app->singleton('rpc.' . $k, function () use ($k, $client) {
|
||||||
return app('rpc')->endpoint($k);
|
return $client->endpoint($k);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user