0%

如何正确的在 Lumen 中启用 Notification

安装 illuminate/notifications

1
composer require illuminate/notifications

bootstrap/app.php 注册服务

1
$app->register(Illuminate\Notifications\NotificationServiceProvider::class);

⚠️ 必须在 AppServiceProvider 注册之前,不然自定义 Channel 会无法找到,提升 InvalidArgumentException with message 'Driver [xxxx] not supported.'

AppServiceProvider.php 注册 Channel

1
2
3
$this->app->make(Illuminate\Notifications\ChannelManager::class)->extend('your-channel', function() {
return $this->app->make(App\Channels\YourChannel::class);
});