fix bug of pargar

This commit is contained in:
2026-07-26 14:15:26 +03:30
parent 667e3736fb
commit 06b3113b98
17 changed files with 561 additions and 26 deletions
+22
View File
@@ -27,6 +27,7 @@ class Product extends Model
private static ?bool $overrideTradingHoursColumnExists = null;
private static ?bool $cashFeePercentModeColumnsExist = null;
private static ?bool $physicalDeliveryColumnsExist = null;
private static ?bool $descriptionColumnExists = null;
protected static function booted(): void
{
@@ -59,6 +60,9 @@ class Product extends Model
if (!static::hasInventoryColumn()) {
unset($product->attributes['inventory']);
}
if (!static::hasDescriptionColumn()) {
unset($product->attributes['description']);
}
if (!static::hasOverrideTradingHoursColumn()) {
unset($product->attributes['override_trading_hours']);
}
@@ -293,6 +297,24 @@ class Product extends Model
return static::$inventoryColumnExists;
}
public static function hasDescriptionColumn(): bool
{
if (static::$descriptionColumnExists !== null) {
return static::$descriptionColumnExists;
}
try {
static::$descriptionColumnExists = Schema::hasColumn(
(new static)->getTable(),
'description'
);
} catch (\Throwable) {
static::$descriptionColumnExists = false;
}
return static::$descriptionColumnExists;
}
public function orderLimitsEnabled(): bool
{
if (!static::hasOrderLimitColumns() || !($this->order_limit_enabled ?? false)) {