Skip to content

Commit afb83cd

Browse files
committed
Set channel (hook) for sending messages
1 parent 40a76cd commit afb83cd

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
@@ -19,6 +19,8 @@ class Slack
1919

2020
protected bool $persist = false;
2121

22+
protected ?string $channel = null;
23+
2224
public function __construct($args = null)
2325
{
2426
$this->queue = collect($args)->flatten();
@@ -43,6 +45,13 @@ public function persist($persist = true): self
4345
return $this;
4446
}
4547

48+
public function channel($channel = null): self
49+
{
50+
$this->channel = $channel;
51+
52+
return $this;
53+
}
54+
4655
private function send($item)
4756
{
4857
/**
@@ -81,7 +90,7 @@ private function send($item)
8190
return call_user_func($cb, $notification);
8291
}
8392

84-
NotificationFacade::route('slack', config('developer.slack_dev_hook'))->notify(
93+
NotificationFacade::route('slack', $this->channel ?? config('developer.slack_dev_hook'))->notify(
8594
$notification
8695
);
8796

0 commit comments

Comments
 (0)