1 | <?php |
||
9 | class PwaServiceProvider extends ServiceProvider |
||
10 | { |
||
11 | /** |
||
12 | * Boot the service provider. |
||
13 | * |
||
14 | * @return void |
||
15 | */ |
||
16 | public function boot() |
||
21 | |||
22 | /** |
||
23 | * Register the service provider. |
||
24 | * |
||
25 | * @return void |
||
26 | */ |
||
27 | public function register() |
||
28 | { |
||
29 | $this->app->singleton('pwa', function () { |
||
30 | return new PWA(); |
||
31 | }); |
||
32 | $this->mergeConfigFrom( |
||
33 | __DIR__.'/../config/pwa.php', |
||
34 | 'config' |
||
35 | ); |
||
36 | $this->loadHelpers(); |
||
37 | $this->registerBladeDirectives(); |
||
38 | $this->registerPublish(); |
||
39 | $this->registerCommands(); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Register blade directories. |
||
44 | * |
||
45 | * @return void |
||
46 | */ |
||
47 | protected function registerBladeDirectives() |
||
48 | { |
||
49 | $this->app->afterResolving('blade.compiler', function (BladeCompiler $blade) { |
||
50 | $blade->directive('PWA', function () { |
||
51 | return "<?php echo view('pwa::meta')->render();?>"; |
||
52 | }); |
||
53 | }); |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * Load all helpers. |
||
58 | * |
||
59 | * @return void |
||
60 | */ |
||
61 | protected function loadHelpers() |
||
67 | |||
68 | /** |
||
69 | * Register publishable assets. |
||
70 | * |
||
71 | * @return void |
||
72 | */ |
||
73 | protected function registerPublish() |
||
103 | |||
104 | /** |
||
105 | * Register commands. |
||
106 | * |
||
107 | * @return void |
||
108 | */ |
||
109 | private function registerCommands() |
||
113 | } |
||
114 |