Example #1
0
 public function slack()
 {
     // Instantiate with defaults, so all messages created
     // will be sent from 'Cyril' and to the #accounting channel
     // by default. Any names like @regan or #channel will also be linked.
     $settings = ['username' => env('SLACK_USERNAME'), 'channel' => env('SLACK_CHANNEL'), 'link_names' => true];
     $client = new \Maknz\Slack\Client(env('SLACK_WEBHOOKS'), $settings);
     $client->send('Test Message!');
     $client->to(array_get($settings, 'channel'))->send('Are we rich yet?');
     $client->from('lubri')->to(array_get($settings, 'channel'))->send('Adventure time!');
     return '';
 }