试验性 更改

This commit is contained in:
iVampireSP.com 2022-11-30 20:27:54 +08:00
parent 2cf12b01dc
commit 444d072dd9
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -90,6 +90,8 @@ class Host extends Model
protected $casts = [ protected $casts = [
// 'configuration' => 'array', // 'configuration' => 'array',
'suspended_at' => 'datetime', 'suspended_at' => 'datetime',
'price' => 'decimal:2',
'managed_price' => 'decimal:2',
]; ];
protected static function boot() protected static function boot()
@ -122,13 +124,13 @@ protected static function boot()
} }
} }
if ($model->isDirty('price')) { // if ($model->isDirty('price')) {
$model->price = round($model->price, 2); // $model->price = round($model->price, 2);
} // }
if ($model->isDirty('managed_price') && $model->managed_price !== null) { // if ($model->isDirty('managed_price') && $model->managed_price !== null) {
$model->managed_price = round($model->managed_price, 2); // $model->managed_price = round($model->managed_price, 2);
} // }
broadcast(new UserEvent($model->user_id, 'hosts.updating', $model)); broadcast(new UserEvent($model->user_id, 'hosts.updating', $model));
}); });