File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -68,15 +68,14 @@ Notice: The originator can contain a maximum of 11 alphanumeric characters.
68
68
Now you can use the channel in your ` via() ` method inside the notification:
69
69
70
70
``` php
71
- use NotificationChannels\Cmsms\CmsmsChannel;
72
71
use NotificationChannels\Cmsms\CmsmsMessage;
73
72
use Illuminate\Notifications\Notification;
74
73
75
74
class VpsServerOrdered extends Notification
76
75
{
77
76
public function via($notifiable)
78
77
{
79
- return [CmsmsChannel::class ];
78
+ return ['cmsms' ];
80
79
}
81
80
82
81
public function toCmsms($notifiable)
Original file line number Diff line number Diff line change 5
5
namespace NotificationChannels \Cmsms ;
6
6
7
7
use GuzzleHttp \Client as GuzzleClient ;
8
+ use Illuminate \Foundation \Application ;
9
+ use Illuminate \Notifications \ChannelManager ;
8
10
use Illuminate \Support \ServiceProvider ;
9
11
use NotificationChannels \Cmsms \Exceptions \InvalidConfiguration ;
10
12
11
13
class CmsmsServiceProvider extends ServiceProvider
12
14
{
13
- public function boot (): void
15
+ public function register (): void
14
16
{
15
17
$ this ->app ->when (CmsmsChannel::class)
16
18
->needs (CmsmsClient::class)
@@ -21,5 +23,9 @@ public function boot(): void
21
23
22
24
return new CmsmsClient (new GuzzleClient (), $ productToken );
23
25
});
26
+
27
+ $ this ->app ->afterResolving (ChannelManager::class, static function (ChannelManager $ manager ) {
28
+ $ manager ->extend ('cmsms ' , static fn (Application $ app ) => $ app ->make (CmsmsChannel::class));
29
+ });
24
30
}
25
31
}
You can’t perform that action at this time.
0 commit comments