From 6213a50b4cd4a0c8e22a9c1c4d74da4fb372d23b Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Sun, 20 Nov 2022 21:41:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Host.php | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/app/Models/Host.php b/app/Models/Host.php index 0cab31c..c682826 100644 --- a/app/Models/Host.php +++ b/app/Models/Host.php @@ -111,7 +111,6 @@ protected static function boot() if ($model->managed_price !== null) { $model->managed_price = round($model->managed_price, 2); - } }); @@ -121,7 +120,6 @@ protected static function boot() }); static::updating(function ($model) { - if ($model->isDirty('status')) { if ($model->status == 'suspended') { $model->suspended_at = now(); @@ -132,12 +130,10 @@ protected static function boot() if ($model->isDirty('price')) { $model->price = round($model->price, 2); - } if ($model->isDirty('managed_price') && $model->managed_price !== null) { $model->managed_price = round($model->managed_price, 2); - } broadcast(new UserEvent($model->user_id, 'hosts.updating', $model)); @@ -150,7 +146,6 @@ protected static function boot() Cache::forget('user_hosts_' . $model->user_id); Cache::forget('user_tasks_' . $model->user_id); - broadcast(new UserEvent($model->user_id, 'hosts.updated', $model)); }); @@ -170,8 +165,6 @@ protected static function boot() }); } - // module - public function getUserHosts($user_id = null) { return $this->where('user_id', $user_id)->with('module', function ($query) { @@ -179,15 +172,11 @@ public function getUserHosts($user_id = null) })->get(); } - // workOrders - public function user(): BelongsToAlias { return $this->belongsTo(User::class); } - // scope - public function module(): BelongsToAlias { return $this->belongsTo(Module::class); @@ -301,7 +290,6 @@ public function safeDelete(): bool public function cost($amount = null, $auto = true): bool { - $this->load('user'); $real_price = $amount ?? $this->price; @@ -312,9 +300,6 @@ public function cost($amount = null, $auto = true): bool } } - // 测试 余额支付 - // echo '拿到的价格' . $real_price . '元' . PHP_EOL; - if ($auto) { // 获取本月天数 $days = now()->daysInMonth;