[英]Laravel Notifications
I am trying to send email notification to user regarding approval or rejection of an application. 我正在尝试向用户发送有关批准或拒绝应用程序的电子邮件通知。 When a user submits an application to the admin, the admin can either accept of reject the users application or send the application to super admin for further verification.
当用户向管理员提交应用程序时,管理员可以接受拒绝用户的应用程序,也可以将应用程序发送给超级管理员以进行进一步验证。
When the admin accepts or rejects the application, I can send an email to the user email to inform him/her regarding the outcome. 当管理员接受或拒绝该应用程序时,我可以向用户电子邮件发送电子邮件,以告知他/她有关结果。 However, when the admin send the application to superadmin for further verification, I am not being able to send an email to the super admin.
但是,当管理员将应用程序发送给超级管理员进行进一步验证时,我无法向超级管理员发送电子邮件。
in the controller i am doing something like this to check what the admins input is 在控制器中,我正在执行类似操作以检查管理员输入的内容
$status = $notification->approved;
if ($status == 2)
{
$string = 'Approved';
$user->notify(new NotificationApplicationStatus($user->name, $notification->id, $string));
return redirect()->route('admin.notification_list');
}
else if($status == 5){
$string = 'Rejected';
$user->notify(new NotificationApplicationStatus($user->name, $notification->id, $string));
return redirect()->route('admin.notification_list');
}
else if ($status == 1){
$string = 'Verify';
$user->notify(new NotificationApplicationStatus($user->name, $notification->id, $string));
return redirect()->route('admin.notification_list');
}
In the NotificationApplicationStatus.php i have something like this 在NotificationApplicationStatus.php中,我有类似这样的内容
public function toMail($notifiable)
{
return (new MailMessage)
->line('Your Notification Application '.$this->id.' has been '.$this->string)
->line('Review Application with the link below')
->action('Notification Application '.$this->id , url('http://localhost:8000'))
->line('Thank you for using our application!');
}
To send email to user. 向用户发送电子邮件。 How can i send email to super admin in case the admin wishes to verify.
如果管理员希望验证,我该如何向超级管理员发送电子邮件。 please Help.
请帮忙。
I would dispatch an event instead and attach multiple listeners to that event. 我将分派一个事件,并将多个侦听器附加到该事件。 Laravel Events
Laravel活动
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.