2017-05-22 6 views
0

私は、アプリケーションの承認または拒否に関して電子メール通知をユーザーに送信しようとしています。 ユーザーが管理者にアプリケーションを送信すると、管理者はユーザーアプリケーションを拒否するか、またはさらに確認するためにアプリケーションをスーパー管理者に送信できます。Laravel Notifications

管理者がアプリケーションを承認または拒否した場合、ユーザーのメールにメールを送信して結果を通知することができます。 しかし、管理者がさらに確認のためにアプリケーションをsuperadminに送信すると、スーパー管理者に電子メールを送信できません。私は管理者の入力がNotificationApplicationStatus.phpで

$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'); 
} 

であるかどうか確認するために、このような何かをやっているコントローラで

は、私は、ユーザーに電子メールを送信するために、この

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!'); 
} 

のようなものを持っています。 管理者が確認したい場合にスーパー管理者に電子メールを送信するにはどうすればいいですか? 助けてください。

答えて

0

私は代わりにイベントをディスパッチし、そのイベントに複数のリスナーを添付します。 Laravel Events

+0

これは理論的に質問に答えるかもしれませんが、答えの本質的な部分を含めて参考にすることが望ましいです(// meta.stackoverflow.com/q/8259)。 – milo526

関連する問題