and the job is added and removed from the queue?
Email Notifications Only Get Sent When Not Queued
I have a pretty simple notification:
class MerchantOrderNotificationEmail extends Notification
{
use Queueable;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct()
{
// ...
}
/**
* 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('New order')
->greeting("Dear {$notifiable->shop_name},")
->line("Some of your items just got purchased.")
->line('Please, press the button below to find out more.')
->action("View orders", url('/'));
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}
When I do $merchant->notify(new MerchantOrderNotificationEmail()), the email gets sent no problem, and I get it from MailTrap.
However, the moment I add implements ShouldQueue to my MerchantOrderNotificationEmail, the queue says this:
2023-05-15 11:38:11 App\Notifications\MerchantOrderNotificationEmail 81.19ms DONE
But the email never arrives... why could this be?
I am using the database driver, and all the migrations have been executed.
Ok I found the issue.
I was using a third party library to use hashids instead of ids on the routes.
This library was replacing the getKey() method of my models, instead of the getRouteKey().
After switching to a different library, everything is working normally.
Thank you everyone for your help!
Please or to participate in this conversation.