简体   繁体   English

为什么 laravel 中的 email 通知不起作用?

[英]why email notification in laravel doesn't work?

I have a simple dashboard to add companies and their employees, i want to send an email notification to admin if there is a new company added, and send an email to company when new employee added.我有一个简单的仪表板来添加公司及其员工,如果添加了新公司,我想向管理员发送 email 通知,并在添加新员工时向公司发送 email 通知。 how to do this using laravel?如何使用 laravel 做到这一点?

i tried to use laravel notification as documentation, but it didn't work.我尝试使用 laravel 通知作为文档,但它没有用。

Maybe some piece of code from your project would be help us to understand.也许您项目中的一些代码会帮助我们理解。

I think the answer you looking for is can be boot method in model.我认为您要寻找的答案可以是 model 中的引导方法。 If you want to check that is there any new company?如果你想看看有没有新公司? Then, go to your Company model and try something like this.然后,将 go 发送到您的公司 model 并尝试类似的操作。

public static function boot(){
     static::creating(function ($model) {
     /*add code about what do you want to do.
     Maybe notify method like this  */
    $model->notify(new NewMessage($variable ));
    });

I am really sorry if I got you wrong, but i am just trying to help you.如果我误会了你,我真的很抱歉,但我只是想帮助你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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