我在事件监听器中添加了构造函数。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.
使用事件门面,您可以在应用程序的 AppServiceProvider 的 boot 方法中手动注册事件及其相应的侦听器
Event::listen(
PodcastProcessed::class,
SendPodcastNotification::class,
);