Conditions | 4 |
Paths | 2 |
Total Lines | 29 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
12 | public function boot() |
||
13 | { |
||
14 | if ($this->app->runningInConsole()) { |
||
15 | $this->publishes([ |
||
16 | __DIR__.'/../config/oh-dear.php' => config_path('oh-dear.php'), |
||
17 | ], 'config'); |
||
18 | } |
||
19 | |||
20 | $this->app->singleton(OhDear::class, function () { |
||
21 | $token = config('oh-dear.api_token'); |
||
22 | |||
23 | if (! $token) { |
||
24 | dump('here'); |
||
25 | throw ConfigNotCorrect::apiTokenMissing(); |
||
26 | } |
||
27 | |||
28 | return new OhDear($token); |
||
29 | }); |
||
30 | |||
31 | $this->app->alias(OhDear::class, 'oh-dear'); |
||
32 | |||
33 | $this->app->bind(Site::class, function () { |
||
34 | if (! $siteUrl = config('oh-dear.site_url')) { |
||
35 | throw ConfigNotCorrect::siteUrlMissing(); |
||
36 | } |
||
37 | |||
38 | return app(OhDear::class)->siteByUrl($siteUrl); |
||
39 | }); |
||
40 | } |
||
41 | |||
47 |