fix: prevent error 500 on profile edition

This commit is contained in:
Valentin Lab
2025-10-04 10:51:41 +02:00
parent 7a189abf0b
commit a7ae946797

View File

@@ -102,8 +102,8 @@ class Customers
public static function storeFull($data)
{
$data2 = $data;
if ($data['sale_channels'] ?? false) {
$saleChannels = $data['sale_channels'] ?? false;
$saleChannels = array_key_exists('sale_channels', $data) ? $data['sale_channels'] : null;
if ($saleChannels !== null) {
unset($data['sale_channels']);
}
if ($data['deliveries'] ?? false) {
@@ -113,7 +113,9 @@ class Customers
unset($data['invoices']);
}
$customer = self::store($data);
$customer->sale_channels()->sync($saleChannels);
if ($saleChannels !== null) {
$customer->sale_channels()->sync($saleChannels);
}
CustomerAddresses::storeByCustomer($customer, $data2);
return $customer->id;