【发布时间】:2019-01-24 11:23:55
【问题描述】:
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
class VerifyEmailNotification extends Notification implements ShouldQueue
{
use Queueable;
protected $token;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct($token)
{
$this->token = $token;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
->subject(config('constants.title') . ' - Please Verify Your Email')
->line('You are receiving this email because you have sign up on ' . config('constants.title') . '.')
->action('Verify Email', url(config('app.url').route('verify_email', ['token' => $this->token], false)))
->line('If you did not sign up on ' . config('constants.title') . ', no further action is required.');
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}
我正在使用 laravel 5.5 电子邮件通知。我已更改此邮件通知,但已在某处缓存。我的应用程序正在向我发送包含旧内容的邮件,而不是我在此处共享的当前代码 sn-p。我正在使用主管来监控队列进程。
我还通过运行以下命令清除了视图缓存,但它确实有效
php artisan view:clear
我也重启了队列
php artisan queue:restart
我也跑过
php artisan config:cache
但似乎没有什么对我有用。
这个问题可能和主管有关吗?
【问题讨论】:
-
你在 Homestead 上运行你的代码吗?
-
我在专用服务器上运行我的代码。
-
转到文件夹 go /storage/framework/views/ 删除所有 if 并检查。
-
当我运行 php artisan view:clear before 检查目录时,/storage/framework/views/ 中有注释
-
也许停止你的工作人员,清除缓存,重新启动工作人员会有所帮助。我什至建议也重新启动主管服务。
标签: php laravel queue supervisord email-notifications