Skip to content

Commit

Permalink
cleans up the Unaccepted Asset reminder variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Godmartinz committed Dec 5, 2024
1 parent 3f8916e commit 9d49b01
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions app/Console/Commands/SendAcceptanceReminder.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,17 @@ public function handle()
$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++;
}
Expand Down

0 comments on commit 9d49b01

Please sign in to comment.