33namespace Georgeboot \LaravelEchoApiGateway ;
44
55use Georgeboot \LaravelEchoApiGateway \Commands \VaporHandle ;
6- use Illuminate \Broadcasting \Broadcasters \Broadcaster ;
76use Illuminate \Broadcasting \BroadcastManager ;
87use Illuminate \Support \Facades \Config ;
98use Illuminate \Support \ServiceProvider as LaravelServiceProvider ;
@@ -20,33 +19,22 @@ public function register()
2019 'driver ' => 'laravel-echo-api-gateway ' ,
2120 ]);
2221
23- if ($ this ->app ->runningInConsole ()) {
24- $ this ->publishes ([
25- __DIR__ . '/../config/laravel-echo-api-gateway.php ' => config_path ('laravel-echo-api-gateway.php ' ),
26- ], 'laravel-echo-api-gateway-config ' );
27- }
28-
29- $ this ->app ->bind (ConnectionRepository::class, function () {
30- return new ConnectionRepository (
31- config ('laravel-echo-api-gateway ' )
32- );
33- });
34-
35- $ this ->app ->bind (SubscriptionRepository::class, function () {
36- return new SubscriptionRepository (
37- config ('laravel-echo-api-gateway ' )
38- );
39- });
22+ $ config = config ('laravel-echo-api-gateway ' );
23+
24+ $ this ->app ->bind (ConnectionRepository::class, fn () => new ConnectionRepository ($ config ));
25+ $ this ->app ->bind (SubscriptionRepository::class, fn () => new SubscriptionRepository ($ config ));
4026 }
4127
4228 public function boot (BroadcastManager $ broadcastManager ): void
4329 {
44- $ broadcastManager ->extend ('laravel-echo-api-gateway ' , function (): Broadcaster {
45- return $ this ->app ->make (Driver::class);
46- });
30+ $ broadcastManager ->extend ('laravel-echo-api-gateway ' , fn () => $ this ->app ->make (Driver::class));
4731
4832 $ this ->commands ([
4933 VaporHandle::class,
5034 ]);
35+
36+ $ this ->publishes ([
37+ __DIR__ . '/../config/laravel-echo-api-gateway.php ' => config_path ('laravel-echo-api-gateway.php ' ),
38+ ], 'laravel-echo-api-gateway-config ' );
5139 }
5240}
0 commit comments