fix bug of pargar
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user