From d72a9f4eb9d266c002e582a924b5d7d637f648c0 Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Mon, 13 Feb 2023 17:05:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=20=E7=BB=AD=E8=B4=B9?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Observers/HostObserver.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Observers/HostObserver.php b/app/Observers/HostObserver.php index 173d5aa..695d76a 100644 --- a/app/Observers/HostObserver.php +++ b/app/Observers/HostObserver.php @@ -21,10 +21,6 @@ public function creating(Host $host): void if ($host->managed_price !== null) { $host->managed_price = bcdiv($host->managed_price, 1, 2); } - - if ($host->billing_cycle !== null) { - $host->next_due_at = $host->getNewDueDate(); - } } /** @@ -41,6 +37,12 @@ public function created(Host $host): void $host->price = bcmul($host->price, 1, 2); $host->user->notify(new WebNotification($host, 'hosts.created')); + + if ($host->isCycle()) { + $host->renew(); + } + + $host->save(); } /**