Skip to content

Commit

Permalink
Handle empty addresses on order status update (#1717)
Browse files Browse the repository at this point in the history
  • Loading branch information
alecritson committed Apr 30, 2024
1 parent 42f39c1 commit c8bb70b
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ protected static function getEmailAddressesInput(): Forms\Components\CheckboxLis
|| ! ($record?->billingAddress?->contact_email && $record->shippingAddress->contact_email);
})->afterStateHydrated(function (Order $record = null, Forms\Components\CheckboxList $component) {
$emails = collect([
$record?->billingAddress->contact_email,
$record?->shippingAddress->contact_email,
$record?->billingAddress?->contact_email,
$record?->shippingAddress?->contact_email,
])->filter()->unique()->map(
fn ($email) => $email
)->toArray();
$component->state($emails);
})->options(function (Order $record = null) {
return collect([
$record?->billingAddress->contact_email,
$record?->shippingAddress->contact_email,
$record?->billingAddress?->contact_email,
$record?->shippingAddress?->contact_email,
])->filter()->unique()->mapWithKeys(
fn ($email) => [$email => $email]
)->toArray();
Expand Down

0 comments on commit c8bb70b

Please sign in to comment.