I have a function in orderController which sends email about new order to all sellers:
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']);
});
}
but the problem is that email sends only when I run in terminal php artisan queue:listen. I tried to run nohup php artisan queue:listen, but terminal tells me that nohup doesn't exists :c.