File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,16 @@ LaravelDeveloper::exceptionToDevSlack(
7373);
7474```
7575
76+ ### Send message to slack
77+
78+ Use this to send any message to your dev slack:
79+
80+ ``` php
81+ use Binarcode\LaravelDeveloper\LaravelDeveloper;
82+
83+ LaravelDeveloper::messageToDevSlack('Hey, we have troubles ;-)');
84+ ```
85+
7686### Send anything to slack
7787
7888Obviously, you can send any kind of message to the slack channel. The ` toDevSlack ` method accept an instance of ` DevNotificationDto ` :
Original file line number Diff line number Diff line change @@ -51,6 +51,18 @@ public static function exceptionToDevSlack(Throwable $t)
5151 ));
5252 }
5353
54+ public static function messageToDevSlack (string $ message )
55+ {
56+ /**
57+ * @var string $class
58+ */
59+ $ class = config ('developer.notification ' , DevNotification::class);
60+
61+ static ::notifyDev (new $ class (
62+ DevNotificationDto::makeWithMessage ($ message )
63+ ));
64+ }
65+
5466 public static function exceptionLogToDevSlack (ExceptionLog $ log )
5567 {
5668 /**
Original file line number Diff line number Diff line change @@ -52,4 +52,13 @@ public function test_can_notify_any_dto()
5252
5353 Notification::assertSentTo (new AnonymousNotifiable , DevNotification::class);
5454 }
55+
56+ public function test_can_notify_with_message ()
57+ {
58+ Notification::fake ();
59+
60+ LaravelDeveloper::messageToDevSlack ('wew ' );
61+
62+ Notification::assertSentTo (new AnonymousNotifiable , DevNotification::class);
63+ }
5564}
You can’t perform that action at this time.
0 commit comments