我在orderController中有一个函数,它向所有卖家发送有关新订单的电子邮件:
public function sendMailToSellers($order, $orderDetails)
{
$sellers = Role::with('users')->where('name', 'seller')->get()->first()->users->toArray();
$emails = [];
foreach ($sellers as $seller) {
$emails[] = $seller['email'];
}
Mail::queue(green.'.orderEmail', ['order_details' => $orderDetails, 'order' => $order], function ($message) use ($emails, $order) {
$message->from('myMail@gmail.com', 'MyShop');
$message->bcc($emails);
$message->subject('New order №' . $order['order_id'].' '. $order['created_at']);
});
}
但问题是只有当我在终端php artisan队列中运行时才发送电子邮件:listen。我试图运行nohup php artisan队列:listen,但终端告诉我nohup不存在:c。