事件和事件监听器 laravel 11

问题描述 投票:0回答:1

我在事件监听器中添加了构造函数。Laravel 11 也没有 EventService 提供程序。我需要一个例子

 public function handle(NewUserEvent $event): void
    {
        Mail::send('3_Emails.1_CommonMailTemplate', $mailData, function ($message) use ($Name, $Email) {
            $message->to($Email)
                ->subject("Contact | $Name")
                ->cc('[email protected]') // Add CC recipient
                ->bcc('[email protected]'); // Add BCC recipient
        });
    }
hete i cant get $event in it.
laravel eventhandler laravel-11
1个回答
0
投票

使用事件门面,您可以在应用程序的 AppServiceProvider 的 boot 方法中手动注册事件及其相应的侦听器

Event::listen(
    PodcastProcessed::class,
    SendPodcastNotification::class,
);
© www.soinside.com 2019 - 2024. All rights reserved.