diff --git a/app/Models/Product.php b/app/Models/Product.php index 200e9ef8..f8b5936b 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -64,9 +64,27 @@ class Product extends Model } } - public function getDailyPrice() + public function getMonthlyPrice() { - return $this->price / 30; + // calculate the hourly price with the billing period + switch($this->billing_period) { + case 'hourly': + return $this->price * 24 * 30; + case 'daily': + return $this->price * 30; + case 'weekly': + return $this->price * 4; + case 'monthly': + return $this->price; + case 'quarterly': + return $this->price / 3; + case 'half-annually': + return $this->price / 6; + case 'annually': + return $this->price / 12; + default: + return $this->price; + } } public function getWeeklyPrice() diff --git a/themes/default/views/servers/index.blade.php b/themes/default/views/servers/index.blade.php index dd417eac..09858c67 100644 --- a/themes/default/views/servers/index.blade.php +++ b/themes/default/views/servers/index.blade.php @@ -62,8 +62,8 @@ {{ $server->product->price == round($server->product->price) ? round($server->product->price) : $server->product->price }}