瀏覽代碼

fix save price

Alexander Musikhin 1 周之前
父節點
當前提交
da22f89639
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      app/Models/Product.php

+ 3 - 3
app/Models/Product.php

@@ -74,7 +74,7 @@ class Product extends Model
     {
         return Attribute::make(
             get: fn(int|null $value) => (float) $value / 100,
-            set: fn (float $value) => (int) ($value * 100),
+            set: fn (float $value) => (int) round($value * 100),
         );
     }
 
@@ -82,7 +82,7 @@ class Product extends Model
     {
         return Attribute::make(
             get: fn(int|null $value) => (float) $value / 100,
-            set: fn (float $value) => (int) ($value * 100),
+            set: fn (float $value) => (int) round($value * 100),
         );
     }
 
@@ -91,7 +91,7 @@ class Product extends Model
     {
         return Attribute::make(
             get: fn(int|null $value) => (float) $value / 100,
-            set: fn (float $value) => (int) ($value * 100),
+            set: fn (float $value) => (int) round($value * 100),
         );
     }