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(); } /**