问题标签 [laravel-notification]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
402 浏览

laravel - 如何使用 Laravel 5.5 同时发送电子邮件和短信?

如何使用 Laravel 5.5 同时发送电子邮件和短信?

我应该使用可邮寄和 SMS 服务还是使用 SMS 通知以及如何使用?

0 投票
1 回答
124 浏览

laravel - Laravel 通知类不传递变量

我无法传递sendSmstoHistory方法。它始终设置为false。我怎样才能正确地做到这一点?

0 投票
1 回答
3286 浏览

laravel - Laravel 通知未邮寄

我第一次使用通知并遇到问题。通过“邮件”和“数据库”实现“欢迎”通知。“数据库”的东西没问题,运行良好。问题是“邮件”部分。当通过“artisan tinker”触发通知时,一切正常并发送邮件(配置“log”以将其写入“laravel.log”)。当使用与 Laravel 中完全相同的代码行时,会写入 db 行,但不会发送邮件。

给修补匠的一句话:日志条目不是在我在命令行上发布代码的那一刻写入的,它是在我在修补匠中说“退出”时写入日志的。

有什么想法出了什么问题???

这是我的通知(Welcome.php):

修补程序命令是:

这是代码触发(非常快速和肮脏)

两种通知方式都不起作用:(

0 投票
1 回答
152 浏览

laravel - 每个字符串的 Laravel 通知电子邮件

在我的通知中,我使用了(MailMessage)->markdown('<file>')语法并且它有效。

不,我想从外部“注入”降价,所以我需要这样的东西

(MailMessage)->markdown("<string">);

我认为你说对了。

当我现在只是将我的降价作为字符串提供给该函数时,它将不起作用并抛出一个

错误信息。

那么,如何在 MailMessage 降价通知中使用字符串模板?

0 投票
1 回答
3179 浏览

laravel - Laravel 通知 - 延迟电子邮件发送并在条件满足时取消

我有一个应用程序,我正在发送推送通知,如果用户登录到应用程序,这很好 - 但是,如果他们没有/如果他们没有在 X 分钟内阅读通知,我想给他们发送一封电子邮件.

我要解决的方法是使用 Laravel Notifications 创建邮件、广播和数据库通知。在toMail()我延迟返回可邮寄的方法上-

分钟后,电子邮件将发送,但是,在发送继续之前,我想执行检查以查看推送/数据库通知是否已标记为已读以及是否已取消电子邮件发送。我能想到的唯一方法是绑定MessageSending到 Laravel 中的事件 -

唯一的问题是这个监听器接收到一个 Swift 邮件事件,而不是我发送的原始邮件,所以我不知道如何取消它。任何想法和提前感谢?

0 投票
1 回答
788 浏览

laravel - 使用自定义频道时未保存 Laravel 通知

我已经这样做了(https://laravel.com/docs/5.7/notifications#database-notifications),我运行了迁移,我在通知中创建了一个 toArray() 和一个 toDatabase() 函数,并且通知是正确的但是,通知不会被保存。我的HablameChannel::send()方法可以发送很多消息,因为一个证书可以有很多电话号码要通知,所以我向他们发送相同的通知。

这是我的频道代码:

这是我的通知代码:

这是我要求通知的代码:

0 投票
1 回答
1081 浏览

mongodb - 根据用户偏好创建通知系统

我正在尝试开发一个通知系统,但我不确定我是否正确地执行了某些部分。为了简化案例,我将使用一些通用命名

系统应该如何工作:

  1. 注册用户可以根据从数据表网格中选择的过滤器订阅通知。(例如,当物品的数量为 X 时通知我,或者设置了多个过滤器,例如 set1.slug.quantity > X,some_value = false 和 some_int = 52)

我如何存储这些偏好:

示例对象

"O:8:"stdClass":2:{s:9:"set1.slug";a:1:{s:3:"$eq";s:10:"item_slug1";}s:13:" set1.quantity";a:1:{s:4:"$gte";i:1;}}"

生成简化

它还将 user_id 和从表单序列化的所有数据附加到部分 MongoDB 原始查询。

数据库存储对象 - 为用户设置的预定义过滤器。Md 是对象的 md5 哈希,以便于访问和编辑。

这就是我将如何使用它——我对它如何工作的看法。

我会在 API 解析器中循环调用 findByFilterMD,同时填充表 Items。

我知道我实现这一目标的尝试可能是完全错误的,我可能会重新发明轮子,因为某些工具可能已经这样做了。

这是一个示例 Item MongoDB 对象

我的问题来了

  • 这种做法合适吗?
  • 通知系统应该在哪里启动?我假设它可能在我解析项目 api 的地方,然后我应该遍历用户过滤器数据并运行存储的对象查询 - 或者它应该是一个用 cron 调用的单独系统?

我愿意接受任何建议,重新设计。

0 投票
2 回答
680 浏览

laravel - Laravel 5.7 Notification -> line 没有转义 html 的选项,但它在 5.5 中工作

我在 Laravel 5.5 和 5.7 中有相同的代码通知,对于 Laravel 5.5,我可以<strong>在 ->line 中使用,但在 5.7 中它会转义它。

在我的通知刀片视图文件中,我设置了 {{ ]} 或 {!! !!},我仍然无法在我的电子邮件中显示 html。在 5.5 中,我不需要转义它仍然可以工作。

我想要的是如下所示的粗体显示。

2019-01-13 15:37

这两种方法也显示了标签,它不会加粗文本。相同的编码工作在 5.5 但不是 Laravel 版本 5.7.20

0 投票
1 回答
7671 浏览

laravel - Laravel 通知想要在通知刀片模板中使用视图 html

我正在使用 Laravel 5.7.20 版来构建自定义降价模板。模板被复制,/resources/views/vendor/notifications/email.blade.php 发出命令后生成模板php artisan vendor:publish --tag=laravel-notifications

以下显示 HTML 的作品:

图片

这是行不通的。这是使用我自己的降价

图片

我的 mail.notification.permission 文件完全是从laravel-project/resources/views/vendor/notifications/email.blade.php

我想我需要view而不是markdown。但是我改变->view('mail.notification.permission');了我得到了错误No hint path defined for [mail]. (View: /Users/shiro/Sites/laravel-project/resources/views/mail/notification/permission.blade.php)

我应该使用html而不是标记格式为我复制哪个文件。

我在通知使用->查看而不是->markdown中没有看到任何解决方案。或者在通知电子邮件中显示 html 的正确流程是什么?

0 投票
0 回答
512 浏览

laravel - The email of the notification being sent is not working in a Laravel unit test

I am developing a Laravel application. I am doing unit test. But having a bit of a problem of testing the email being sent.

My test code is something like this.

In the actual implementation. I am sending the notification as the email. The notification was sent in the event.

I have a notifiable model like this.

I send the notification in the event like this.

Then I have a listener for that event like this.

As you can see, in the listener, I am sending notification (ApplicationCreatedNotification). This is the definition of ApplicationCreatedNotification.

As you can see, the notification is sent as an email (Mailable).

This is my mailable class (ApplicationCreatedEmail).

Then in the code, I trigger the event like this in the controller.

If you go back to the test, as you can see, I am trying to test if the email is being sent. But it is failing because the email was not sent. But instead, if I test if the notification is sent like this.

It works. Testing the notification works. Testing the email being sent is failing. But if I test the email being sent, the email class is triggered as well because I logged the variables using dd() helper. It even runs the build function of mailable with any errors. Just the test is failing. What is the possible error? How can I fix it?