1 | <?php |
||
9 | class WebPushServiceProvider extends ServiceProvider |
||
10 | { |
||
11 | /** |
||
12 | * Register the application services. |
||
13 | * |
||
14 | * @return void |
||
15 | */ |
||
16 | 14 | public function register() |
|
22 | |||
23 | /** |
||
24 | * Bootstrap the application services. |
||
25 | * |
||
26 | * @return void |
||
27 | */ |
||
28 | 14 | public function boot() |
|
29 | { |
||
30 | 14 | $this->app->when(WebPushChannel::class) |
|
31 | 14 | ->needs(WebPush::class) |
|
32 | 14 | ->give(function () { |
|
33 | $webPush = new WebPush($this->webPushConfig()); |
||
34 | $webPush->setReuseVAPIDHeaders(true); |
||
35 | |||
36 | return $webPush; |
||
37 | 14 | }); |
|
38 | |||
39 | 14 | $this->app->when(WebPushChannel::class) |
|
40 | 14 | ->needs(ReportHandlerInterface::class) |
|
41 | 14 | ->give(ReportHandler::class); |
|
42 | |||
43 | 14 | if ($this->app->runningInConsole()) { |
|
44 | 14 | $this->definePublishing(); |
|
45 | } |
||
46 | 14 | } |
|
47 | |||
48 | /** |
||
49 | * @return array |
||
50 | */ |
||
51 | protected function webPushConfig() |
||
83 | |||
84 | /** |
||
85 | * Define the publishable migrations and resources. |
||
86 | * |
||
87 | * @return void |
||
88 | */ |
||
89 | 14 | protected function definePublishing() |
|
103 | } |
||
104 |