Signup for events implemented
This commit is contained in:
97
app/Mail/EventSignUpSuccessfull.php
Normal file
97
app/Mail/EventSignUpSuccessfull.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Enumerations\EfzStatus;
|
||||
use App\Models\EventParticipant;
|
||||
use App\Resources\EventParticipantResource;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Attachment;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class EventSignUpSuccessfull extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct(
|
||||
private EventParticipant $participant,
|
||||
)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
$participant = $this->participant->toResource()->toArray(new Request());
|
||||
|
||||
$subject = sprintf(
|
||||
$participant['needs_payment'] ? 'Teilnahme- & Zahlungsinformationen %1$s %2$s' : 'Anmeldebestätigung %1$s %2$s',
|
||||
'für die Veranstaltung',
|
||||
$this->participant->event()->first()->name
|
||||
);
|
||||
|
||||
|
||||
return new Envelope(
|
||||
subject: $subject,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
public function content(): Content
|
||||
{
|
||||
$event = $this->participant->event()->first()->toResource()->toArray(new Request());
|
||||
$participant = $this->participant->toResource()->toArray(new Request());
|
||||
|
||||
$girocodeProvider = new \App\Providers\GiroCodeProvider(
|
||||
$event['accountOwner'],
|
||||
$event['accountIban'],
|
||||
(float) $participant['amount_left_value'],
|
||||
$participant['payment_purpose']
|
||||
);
|
||||
$girocodeBinary = (string)$girocodeProvider->create();
|
||||
|
||||
return new Content(
|
||||
view: 'emails.events.signup_complete',
|
||||
with: [
|
||||
'participationType' => $participant['participationType'],
|
||||
'name' => $participant['nicename'],
|
||||
'eventTitle' => $event['name'],
|
||||
'eventEmail' => $event['email'],
|
||||
'arrival' => $participant['arrival'],
|
||||
'departure' => $participant['departure'],
|
||||
'amount' => $participant['amount_left_string'],
|
||||
'paymentFinalDate' => $event['registrationFinalEnd']['formatted'],
|
||||
'paymentRequired' => $participant['needs_payment'],
|
||||
'accountOwner' => $event['accountOwner'],
|
||||
'accountIban' => $event['accountIban'],
|
||||
'paymentPurpose' => $participant['payment_purpose'],
|
||||
'girocodeBinary' => $girocodeBinary,
|
||||
'efzStatus' => $participant['efz_status']
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user