1

I'm building a SAAS and I want each tenant to have their own queue for notifications. I have a notification class that implements Illuminate\Contracts\Queue\ShouldQueue and I send the notification like this

$user->notify($notification);

But I haven't found a way to specify the queue that I want the notification to be pushed to. I know that jobs can be pushed to specific queues with onQueue:

ProcessPodcast::dispatch($podcast)->onQueue('tenant1');

But is it possible to do something like this for queueable notifications as well?

miken32
  • 42,008
  • 16
  • 111
  • 154
Chris
  • 4,277
  • 7
  • 40
  • 55

1 Answers1

2

Since your notification should use the Illuminate\Bus\Queueable trait you can simply set the $queue property of the object. There's a helper function for it:

$notification->onQueue('tenant1');
$user->notify($notification);
miken32
  • 42,008
  • 16
  • 111
  • 154