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.
6868Now you can use the channel in your ` via() ` method inside the notification:
6969
7070``` php
71- use NotificationChannels\Cmsms\CmsmsChannel;
7271use NotificationChannels\Cmsms\CmsmsMessage;
7372use Illuminate\Notifications\Notification;
7473
7574class VpsServerOrdered extends Notification
7675{
7776 public function via($notifiable)
7877 {
79- return [CmsmsChannel::class ];
78+ return ['cmsms' ];
8079 }
8180
8281 public function toCmsms($notifiable)
Original file line number Diff line number Diff line change 55namespace NotificationChannels \Cmsms ;
66
77use GuzzleHttp \Client as GuzzleClient ;
8+ use Illuminate \Foundation \Application ;
9+ use Illuminate \Notifications \ChannelManager ;
810use Illuminate \Support \ServiceProvider ;
911use NotificationChannels \Cmsms \Exceptions \InvalidConfiguration ;
1012
1113class CmsmsServiceProvider extends ServiceProvider
1214{
13- public function boot (): void
15+ public function register (): void
1416 {
1517 $ this ->app ->when (CmsmsChannel::class)
1618 ->needs (CmsmsClient::class)
@@ -21,5 +23,9 @@ public function boot(): void
2123
2224 return new CmsmsClient (new GuzzleClient (), $ productToken );
2325 });
26+
27+ $ this ->app ->afterResolving (ChannelManager::class, static function (ChannelManager $ manager ) {
28+ $ manager ->extend ('cmsms ' , static fn (Application $ app ) => $ app ->make (CmsmsChannel::class));
29+ });
2430 }
2531}
You can’t perform that action at this time.
0 commit comments