From 83d721c1caa3cb191d877ae80f9783c0d67deba9 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Wed, 28 May 2025 18:46:12 +0200 Subject: [PATCH] Make mailRecipient optional --- app/Form/Models/Participant.php | 2 +- app/Prevention/Contracts/Preventable.php | 2 +- app/Prevention/Mails/PreventionRememberMail.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Form/Models/Participant.php b/app/Form/Models/Participant.php index b34fc4e9..1db6002a 100644 --- a/app/Form/Models/Participant.php +++ b/app/Form/Models/Participant.php @@ -94,7 +94,7 @@ class Participant extends Model implements Preventable return $this->member?->preventions($this->form->from) ?: []; } - public function getMailRecipient(): stdClass + public function getMailRecipient(): ?stdClass { return $this->getFields()->getMailRecipient(); } diff --git a/app/Prevention/Contracts/Preventable.php b/app/Prevention/Contracts/Preventable.php index f6b487d7..472355c1 100644 --- a/app/Prevention/Contracts/Preventable.php +++ b/app/Prevention/Contracts/Preventable.php @@ -16,5 +16,5 @@ interface Preventable */ public function preventions(): array; - public function getMailRecipient(): stdClass; + public function getMailRecipient(): ?stdClass; } diff --git a/app/Prevention/Mails/PreventionRememberMail.php b/app/Prevention/Mails/PreventionRememberMail.php index d435d1a7..2ab91b39 100644 --- a/app/Prevention/Mails/PreventionRememberMail.php +++ b/app/Prevention/Mails/PreventionRememberMail.php @@ -25,7 +25,7 @@ class PreventionRememberMail extends Mailable { $this->settings = app(InvoiceSettings::class); $this->bodyText = $this->bodyText - ->replaceWithList('wanted', collect($preventable->preventions())->map(fn ($prevention) => $prevention->text())->toArray()); + ->replaceWithList('wanted', collect($preventable->preventions())->map(fn($prevention) => $prevention->text())->toArray()); } /**