Chaos-Events und Voranmeldungen
This commit is contained in:
66
app/Mail/PreApplicationMail.php
Normal file
66
app/Mail/PreApplicationMail.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use AllowDynamicProperties;
|
||||
use App;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Attachment;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class PreApplicationMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct(protected App\Models\PreApplications $pa, protected string $lang = 'de')
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: __('mail.preapplication.subject'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
public function content(): Content
|
||||
{
|
||||
App::setLocale($this->lang);
|
||||
return new Content(
|
||||
view: 'mail.preapplication',
|
||||
with: ['pa' => $this->pa],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
$lang = match (App::getLocale()) {
|
||||
'de' => 'dk',
|
||||
'en' => 'ek',
|
||||
default => 'dk',
|
||||
};
|
||||
return [
|
||||
Attachment::fromPath(public_path('Dokumente/c3gov_fb5' . $lang . '.pdf'))
|
||||
->withMime('application/pdf'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user