From e730094dce6a21c562d529c0b27ba58b2b5edfdc Mon Sep 17 00:00:00 2001 From: Bas van Dinther Date: Mon, 13 Jan 2025 16:21:12 +0100 Subject: [PATCH] fix: Dynamically determine if tenant is set (#16) --- src/Controllers/MailDownloadController.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Controllers/MailDownloadController.php b/src/Controllers/MailDownloadController.php index 85f88ec..50af302 100644 --- a/src/Controllers/MailDownloadController.php +++ b/src/Controllers/MailDownloadController.php @@ -8,12 +8,15 @@ class MailDownloadController extends Controller { - public function __invoke( - ?string $tenant, - string $mail, - string $attachment, - string $filename - ) { + public function __invoke(...$arguments) + { + if (count($arguments) === 4) { + [$tenant, $mail, $attachment, $filename] = $arguments; + } else { + [$mail, $attachment, $filename] = $arguments; + $tenant = null; + } + /** @var MailAttachment $attachment */ $attachment = MailAttachment::find($attachment);