3
3
namespace Georgeboot \LaravelEchoApiGateway ;
4
4
5
5
use Georgeboot \LaravelEchoApiGateway \Commands \VaporHandle ;
6
- use Illuminate \Broadcasting \Broadcasters \Broadcaster ;
7
6
use Illuminate \Broadcasting \BroadcastManager ;
8
7
use Illuminate \Support \Facades \Config ;
9
8
use Illuminate \Support \ServiceProvider as LaravelServiceProvider ;
@@ -20,33 +19,22 @@ public function register()
20
19
'driver ' => 'laravel-echo-api-gateway ' ,
21
20
]);
22
21
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 ));
40
26
}
41
27
42
28
public function boot (BroadcastManager $ broadcastManager ): void
43
29
{
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));
47
31
48
32
$ this ->commands ([
49
33
VaporHandle::class,
50
34
]);
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 ' );
51
39
}
52
40
}
0 commit comments