Cronjobs implemented

This commit is contained in:
2026-04-25 00:32:15 +02:00
parent 4878f750bd
commit 2e8daf78e1
10 changed files with 231 additions and 6 deletions

View File

@@ -0,0 +1,73 @@
<?php
namespace App\Mail\EventReportMails;
use App\Models\Event;
use App\Models\EventParticipant;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Http\Request;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Attachment;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
class InformLocalGroupMail extends Mailable
{
public function __construct(
private Event $event,
private Collection $participants,
)
{
//
}
/**
* Get the message envelope.
*/
public function envelope(): Envelope
{
$subject = sprintf(
'Teilnehmendenübersicht %1$s %2$s',
'für die Veranstaltung',
$this->event->name
);
return new Envelope(
subject: $subject,
);
}
/**
* Get the message content definition.
*/
public function content(): Content
{
$event = $this->event->toResource()->toArray(new Request());
$participants = [];
foreach ($this->participants as $participant) {
$_t = $participant->toResource()->toArray(new Request());
$participants[$_t['participationType']][] = $_t;
}
return new Content(
view: 'emails.events.participant_report_localgroups',
with: [
'participantGroups' => $participants,
'eventTitle' => $event['name'],
'eventEmail' => $event['email'],
],
);
}
/**
* Get the attachments for the message.
*
* @return array<int, Attachment>
*/
public function attachments(): array
{
return [];
}
}