-
Notifications
You must be signed in to change notification settings - Fork 205
/
Copy pathSlackServiceProviderLaravel5.php
48 lines (41 loc) · 1.33 KB
/
SlackServiceProviderLaravel5.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php namespace Maknz\Slack;
use Illuminate\Support\ServiceProvider;
use GuzzleHttp\Client as Guzzle;
class SlackServiceProviderLaravel5 extends ServiceProvider {
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->publishes([__DIR__ . '/config/config.php' => config_path('slack.php')]);
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->mergeConfigFrom(__DIR__ . '/config/config.php', 'slack');
$this->app['maknz.slack'] = $this->app->share(function($app)
{
return new Client(
$app['config']->get('slack.endpoint'),
[
'channel' => $app['config']->get('slack.channel'),
'username' => $app['config']->get('slack.username'),
'icon' => $app['config']->get('slack.icon'),
'link_names' => $app['config']->get('slack.link_names'),
'unfurl_links' => $app['config']->get('slack.unfurl_links'),
'unfurl_media' => $app['config']->get('slack.unfurl_media'),
'allow_markdown' => $app['config']->get('slack.allow_markdown'),
'markdown_in_attachments' => $app['config']->get('slack.markdown_in_attachments')
],
new Guzzle
);
});
$this->app->bind('Maknz\Slack\Client', 'maknz.slack');
}
}