I have the following notification class:
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
class ConfirmEmailNotification extends Notification implements ShouldQueue
{
use Queueable;
public function __construct()
{
//
}
public function via($notifiable)
{
return ['mail'];
}
public function toMail($notifiable)
{
$user = $notifiable;
$url = url('/register/confirm/'. $user->confirmation_token);
return (new MailMessage)
->subject('Confirm Email')
->markdown('emails.confirm', ['user' => $user, 'url' => $url]);
}
public function toArray($notifiable)
{
return [
//
];
}
}
In my controller I have the following:
$when = now()->addSeconds(30);
$user->notify((new ConfirmEmailNotification())->delay($when));
But nothing is getting added to the queue table - the emails is being fired instantly?
I configured the queue as follows.
In my env file:
QUEUE_DRIVER=database
In my config/queue.php I have renamed the table as follows:
'database' => [
'driver' => 'database',
'table' => 'queued_jobs',
'queue' => 'default',
'retry_after' => 90,
],
Run the following:
php artisan queue:table
php artisan migrate
php artisan queue:work
I've tried php artisan config:clear
but no difference.
Any ideas chaps?