2021-07-18 21:38:00 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Payment;
|
|
|
|
|
2022-03-20 16:33:56 +01:00
|
|
|
use App\Pdf\LetterRepository;
|
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-03-20 16:33:56 +01:00
|
|
|
public LetterRepository $repo;
|
2021-07-18 21:38:00 +02:00
|
|
|
public string $filename;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new message instance.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2022-03-20 16:33:56 +01:00
|
|
|
public function __construct(LetterRepository $repo, string $filename)
|
2021-07-18 21:38:00 +02:00
|
|
|
{
|
|
|
|
$this->filename = $filename;
|
|
|
|
$this->repo = $repo;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Build the message.
|
|
|
|
*
|
|
|
|
* @return $this
|
|
|
|
*/
|
|
|
|
public function build()
|
|
|
|
{
|
2021-10-29 22:02:21 +02:00
|
|
|
$template = Str::snake(class_basename($this->repo));
|
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')
|
2021-10-29 22:02:21 +02:00
|
|
|
->subject($this->repo->getMailSubject().' | DPSG Stamm Silva');
|
2021-07-18 21:38:00 +02:00
|
|
|
}
|
|
|
|
}
|