From e94ee48f741846cd8ee4d51987fdb9848ac744f9 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Thu, 30 Jan 2025 10:37:11 -0800 Subject: [PATCH] Extract helper --- app/Mail/CheckoutAssetMail.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/Mail/CheckoutAssetMail.php b/app/Mail/CheckoutAssetMail.php index d6ce123d40..eb9619217f 100644 --- a/app/Mail/CheckoutAssetMail.php +++ b/app/Mail/CheckoutAssetMail.php @@ -58,15 +58,9 @@ class CheckoutAssetMail extends Mailable { $from = new Address(config('mail.from.address'), config('mail.from.name')); - $subject = trans('mail.Asset_Checkout_Notification'); - - if (!$this->firstTimeSending) { - $subject = trans('mail.Asset_Checkout_Reminder_Notification'); - } - return new Envelope( from: $from, - subject: $subject, + subject: $this->getSubject(), ); } @@ -117,4 +111,13 @@ class CheckoutAssetMail extends Mailable { return []; } + + private function getSubject(): string + { + if ($this->firstTimeSending) { + return trans('mail.Asset_Checkout_Notification'); + } + + return trans('mail.Asset_Checkout_Reminder_Notification'); + } }