From 9d49b01958f1c036f5ee541be07b6fd5dac5d800 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Thu, 5 Dec 2024 11:46:56 -0800 Subject: [PATCH] cleans up the Unaccepted Asset reminder variables --- app/Console/Commands/SendAcceptanceReminder.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Console/Commands/SendAcceptanceReminder.php b/app/Console/Commands/SendAcceptanceReminder.php index aa80bf3e44..e9eb5c18f5 100644 --- a/app/Console/Commands/SendAcceptanceReminder.php +++ b/app/Console/Commands/SendAcceptanceReminder.php @@ -68,16 +68,17 @@ class SendAcceptanceReminder extends Command $no_mail_address = []; foreach($unacceptedAssetGroups as $unacceptedAssetGroup) { - - $locale = $unacceptedAssetGroup[0]['acceptance']->assignedTo?->locale; - $email = $unacceptedAssetGroup[0]['acceptance']->assignedTo?->email; + //the [0] is weird, but it allows for the item_count to work and grabs the appropriate info for each user. collapsing and flattening the query doesn't work above. + $acceptance = $unacceptedAssetGroup[0]['acceptance']; + $locale = $acceptance->assignedTo?->locale; + $email = $acceptance->assignedTo?->email; $item_count = $unacceptedAssetGroup->count(); if ($locale && $email) { - Mail::to($email)->send((new UnacceptedAssetReminderMail($unacceptedAssetGroup[0]['acceptance'], $item_count))->locale($locale)); + Mail::to($email)->send((new UnacceptedAssetReminderMail($acceptance, $item_count))->locale($locale)); } elseif ($email) { - Mail::to($email)->send((new UnacceptedAssetReminderMail($unacceptedAssetGroup[0]['acceptance'], $item_count))); + Mail::to($email)->send((new UnacceptedAssetReminderMail($acceptance, $item_count))); } $count++; }