修改价格属性转换
parent
54adb39b83
commit
39dc3f7150
|
|
@ -17,6 +17,10 @@ class Price implements CastsAttributes
|
||||||
*/
|
*/
|
||||||
public function get($model, string $key, $value, array $attributes)
|
public function get($model, string $key, $value, array $attributes)
|
||||||
{
|
{
|
||||||
|
if ((string) $value === '') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return bcdiv($value, 100, 2);
|
return bcdiv($value, 100, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -31,6 +35,10 @@ class Price implements CastsAttributes
|
||||||
*/
|
*/
|
||||||
public function set($model, string $key, $value, array $attributes)
|
public function set($model, string $key, $value, array $attributes)
|
||||||
{
|
{
|
||||||
|
if ((string) $value === '') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (int) bcmul($value, 100);
|
return (int) bcmul($value, 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue