diff --git a/app/Repositories/Shop/PriceListValues.php b/app/Repositories/Shop/PriceListValues.php index 40129186..322e66f3 100644 --- a/app/Repositories/Shop/PriceListValues.php +++ b/app/Repositories/Shop/PriceListValues.php @@ -46,12 +46,23 @@ class PriceListValues { foreach ($values as $value) { $value['price_list_id'] = $price_list_id; - if ($value['price']) { + if (self::hasPrice($value)) { self::store($value); } } } + protected static function hasPrice($value): bool + { + if (! array_key_exists('price', $value)) { + return false; + } + + $price = $value['price']; + + return $price !== null && $price !== ''; + } + public static function getModel() { return PriceListValue::query();