*/ public $backoff = [2, 5, 10, 30]; public function __construct(public User $user) { $this->onQueue('emails'); } abstract protected function dripSubject(): string; abstract protected function template(): string; /** * Extra view data merged alongside the recipient's name. * * @return array */ protected function contentData(): array { return []; } /** * Whether replies should route back to the drip sender address. */ protected function repliesToSender(): bool { return false; } public function envelope(): Envelope { $from = new Address( config('mail.drip_from.address', 'hi@whisper.money'), config('mail.drip_from.name', 'Álvaro and Víctor'), ); return new Envelope( from: $from, replyTo: $this->repliesToSender() ? [$from] : [], subject: $this->dripSubject(), ); } public function content(): Content { return new Content( markdown: $this->template(), with: [ 'userName' => $this->user->name, ...$this->contentData(), ], ); } /** * Get the middleware the job should pass through. * * @return array */ public function middleware(): array { return [(new RateLimited('emails'))->releaseAfter(1)]; } }