*/ public $backoff = [2, 5, 10, 30]; public function __construct( public User $user, public string $viewName, public string $emailIdentifier, public string $subject = 'Update from Whisper Money' ) { $this->onQueue('emails'); } public function handle(): void { if (! $this->user->canReceiveEmails()) { return; } if ($this->hasReceivedUpdate()) { return; } Mail::to($this->user)->send( new UpdateEmail($this->user, $this->viewName, $this->subject) ); UserMailLog::create([ 'user_id' => $this->user->id, 'email_type' => DripEmailType::Update, 'email_identifier' => $this->emailIdentifier, 'sent_at' => now(), ]); } protected function hasReceivedUpdate(): bool { return UserMailLog::where('user_id', $this->user->id) ->where('email_type', DripEmailType::Update) ->where('email_identifier', $this->emailIdentifier) ->exists(); } }