简体   繁体   中英

Canceling Notifications Laravel 5.3 (Via)

So, let's say that I want to have my Notification Check logic within Via (as in, should this be sent based on a variable on the User). I notice that, if I do it this way in via:

return $notifiable->comment_email ? ['mail'] : false; 

it will successfully send if comment_email is true on the User. However, if it is false, then I want the notification to be cancelled all together, which I assumed returning False would do - it does not, just throws an error. So how would I cancel it in the via? Is it possible?

而是返回false,您必须返回一个空数组:

return $notifiable->comment_email ? ['mail'] : []; 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM