Skip to content

Commit ae71d88

Browse files
committed
Add custom creator alias to ChannelManager
1 parent 12d3da0 commit ae71d88

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/CmsmsServiceProvider.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
namespace NotificationChannels\Cmsms;
66

77
use GuzzleHttp\Client as GuzzleClient;
8+
use Illuminate\Foundation\Application;
9+
use Illuminate\Notifications\ChannelManager;
810
use Illuminate\Support\ServiceProvider;
911
use NotificationChannels\Cmsms\Exceptions\InvalidConfiguration;
1012

1113
class 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
}

0 commit comments

Comments
 (0)