adrema/app/Payment/PaymentMail.php

47 lines
1.1 KiB
PHP
Raw Normal View History

2021-07-18 21:38:00 +02:00
<?php
namespace App\Payment;
2022-11-07 16:18:11 +01:00
use App\Letter\Letter;
2021-07-18 21:38:00 +02:00
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
2021-10-29 22:02:21 +02:00
use Illuminate\Support\Str;
2021-07-18 21:38:00 +02:00
class PaymentMail extends Mailable
{
2022-03-11 20:19:17 +01:00
use Queueable;
use SerializesModels;
2022-11-07 16:18:11 +01:00
public Letter $letter;
2021-07-18 21:38:00 +02:00
public string $filename;
2022-11-07 16:18:11 +01:00
public string $salutation;
2021-07-18 21:38:00 +02:00
/**
* Create a new message instance.
*
* @return void
*/
2022-11-07 16:18:11 +01:00
public function __construct(Letter $letter, string $filename)
2021-07-18 21:38:00 +02:00
{
2022-11-07 16:18:11 +01:00
$this->letter = $letter;
2021-07-18 21:38:00 +02:00
$this->filename = $filename;
2022-11-07 16:18:11 +01:00
$this->salutation = 'Liebe Familie '.$letter->pages->first()->familyName;
2021-07-18 21:38:00 +02:00
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
2022-11-07 16:18:11 +01:00
$template = Str::snake(class_basename($this->letter));
2022-03-11 20:19:17 +01:00
2021-10-29 22:02:21 +02:00
return $this->markdown('mail.payment.'.$template)
2021-07-18 21:38:00 +02:00
->attach($this->filename)
->replyTo('kasse@stamm-silva.de')
2022-11-07 16:18:11 +01:00
->subject($this->letter->getSubject().' | DPSG Stamm Silva');
2021-07-18 21:38:00 +02:00
}
}