php - 如何在 Laravel Horizo​​n 中使用标签

标签 php laravel email tags laravel-horizon

我在作业队列中的跟踪标签没有显示我期望的标签。更改为类后作业不处理。

我的工作示例类是:

class EmailUser implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    /**
     * The user instance.
     *
     * @var \App\User
     */
    public $user;

    /**
     * Create a new job instance.
     *
     * @param  \App\User  $user
     * @return void
     */
    public function __construct(User  $user)
    {
        $this->user = $user;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        Mail::to('fesher@example.com')->send(new ApplicationReceivedEmail());
    }

   /**
     * Get the tags that should be assigned to the job.
     *
     * @return array
     */
    public function tags()
    {
        return ['email', 'user:'.$this->user];
    }
}

现在,在我手动标记作业类之前,电子邮件已正常发送并且一切正常。添加标签方法杀死进程,邮件不再正常发送。

我从这里网站上的例子开始 https://laravel.com/docs/5.5/horizon#tags

有人可以帮忙吗?谢谢

最佳答案

您正在尝试将 Eloquent 集合连接到标记字符串,它应该是 nameID 之类的东西。

变化:

    return ['email', 'user:'.$this->user];

收件人:

    return ['email', 'user:'.$this->user->id];

关于php - 如何在 Laravel Horizo​​n 中使用标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48537360/

相关文章:

php - 将内联 css 样式添加到 Magento 导航列表项

laravel - PHPUnit测试依赖项

json - Eloquent 集合返回 json

wordpress - 自定义验证以在 wordpress 中的联系表格 7 中检查企业电子邮件和电话号码

javascript - 如何通过 Gmail API 在 JavaScript 中发送带有附件的邮件

php - 在 WordPress 中添加侧边栏

php - 使用PHP将字符串分成相等的部分

php - Laravel:文件上传不起作用

使用 OctoberCMS 进行电子邮件排队

php - 在 AWS EC2 上重新启动 httpd 会出现异常。是不是要把/var/www/html的内容删掉?