Skip to content

Commit 0f60c13

Browse files
authored
Merge pull request #9 from maloun96/slack_channels
Set channel (hook) for sending messages
2 parents 719585f + 9bdd622 commit 0f60c13

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Notifications/Slack.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class Slack
2121

2222
protected bool $persist = false;
2323

24+
protected ?string $channel = null;
25+
2426
protected bool $telescope = true;
2527

2628
public function __construct($args = null)
@@ -47,6 +49,13 @@ public function persist($persist = true): self
4749
return $this;
4850
}
4951

52+
public function channel(string $channel): self
53+
{
54+
$this->channel = $channel;
55+
56+
return $this;
57+
}
58+
5059
private function send($item)
5160
{
5261
/**
@@ -89,7 +98,7 @@ private function send($item)
8998
return call_user_func($cb, $notification);
9099
}
91100

92-
NotificationFacade::route('slack', config('developer.slack_dev_hook'))->notify(
101+
NotificationFacade::route('slack', $this->channel ?? config('developer.slack_dev_hook'))->notify(
93102
$notification
94103
);
95104

0 commit comments

Comments
 (0)