app->configure('rpc'); $config = config('rpc.client'); $this->app->singleton('rpc', function () use ($config) { return new Client($config); }); foreach ($config as $k => $item) { $this->app->singleton('rpc.' . $k, function () use ($k) { return app('rpc')->endpoint($k); }); } } public function provides() { return ['rpc']; } }