我需要向队列中的用户发送提醒电子邮件
目前我有
UserController.php
public function postSendUsersPaymentRequest(Request $request){
$users_ids = $request->get('user_checked');
dispatch(new SendPaymentRequestEmail($users_ids));
return response()->json(['code' => 200], 200);
}
\应用\作业\ SendPaymentRequestEmail.php
public function handle(UserRepository $userRepo)
{
$users = $userRepo->getUserInfoDetails(3,1,1)->whereIn('user_id',$this->users_ids);
foreach($users as $user){
$this->emailPaymentRequest($user);
}
}
private function emailPaymentRequest($user){
Mail::queue($this->email_vew, ['user' => $user], function ($m) use ($user) {
$from = Config::get('mail.from');
$project_name = Config::get('app.project_name');
$m->from('fromemail', $project_name);
$m->to('toemail', $user->name)->subject('Payment Request');
});
}
但电子邮件无需排队即可发送。
感谢您提前提供任何帮助。
答案 0 :(得分:0)
将QUEUE_DRIVER=database
添加到 .env 文件中。