Conditions | 3 |
Paths | 3 |
Total Lines | 26 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | public function boot() |
||
17 | { |
||
18 | $this->publishes([ |
||
19 | __DIR__ . '/slack-alert.php' => config_path('slack-alert.php'), |
||
20 | ]); |
||
21 | |||
22 | $enabledForEnvironments = config('slack-alert.environments'); |
||
23 | |||
24 | if (in_array($this->app->environment(), $enabledForEnvironments)) { |
||
25 | |||
26 | $channel = config('slack-alert.channel'); |
||
27 | $token = config('slack-alert.token'); |
||
28 | $name = config('slack-alert.app_name'); |
||
29 | $mentionTo = config('slack-alert.mention_to'); |
||
30 | $level = config('slack-alert.level'); |
||
31 | |||
32 | if ($token) { |
||
33 | /** @var Writer $logger */ |
||
34 | $logger = $this->app['log']; |
||
35 | |||
36 | $slackHandler = new MentionedSlackHandler($token, $channel, $name, true, null, $level); |
||
37 | $slackHandler->setMentionTo($mentionTo); |
||
38 | $logger->getMonolog()->pushHandler($slackHandler); |
||
39 | } |
||
40 | } |
||
41 | } |
||
42 | |||
53 |