diff --git a/app/Models/Company.php b/app/Models/Company.php index 1873a590f..a70ae3675 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -202,7 +202,7 @@ class Company extends Eloquent $this->promo_expires = date_create()->modify('3 days')->format('Y-m-d'); } - public function applyFreeYear() + public function applyFreeYear($numYears = 1) { if ($this->plan_started && $this->plan_started != '0000-00-00') { return; @@ -213,7 +213,7 @@ class Company extends Eloquent $this->plan_price = PLAN_PRICE_PRO_MONTHLY; $this->plan_started = date_create()->format('Y-m-d'); $this->plan_paid = date_create()->format('Y-m-d'); - $this->plan_expires = date_create()->modify('1 year')->format('Y-m-d'); + $this->plan_expires = date_create()->modify($numYears . ' year')->format('Y-m-d'); } } diff --git a/app/Ninja/Repositories/AccountRepository.php b/app/Ninja/Repositories/AccountRepository.php index abb1e6e06..35a28d5d5 100644 --- a/app/Ninja/Repositories/AccountRepository.php +++ b/app/Ninja/Repositories/AccountRepository.php @@ -47,10 +47,10 @@ class AccountRepository if (Input::get('utm_campaign')) { if (env('PROMO_CAMPAIGN') && hash_equals(Input::get('utm_campaign'), env('PROMO_CAMPAIGN'))) { $company->applyDiscount(.75); - } - - if (env('PARTNER_CAMPAIGN') && hash_equals(Input::get('utm_campaign'), env('PARTNER_CAMPAIGN'))) { + } elseif (env('PARTNER_CAMPAIGN') && hash_equals(Input::get('utm_campaign'), env('PARTNER_CAMPAIGN'))) { $company->applyFreeYear(); + } elseif (env('EDUCATION_CAMPAIGN') && hash_equals(Input::get('utm_campaign'), env('EDUCATION_CAMPAIGN'))) { + $company->applyFreeYear(2); } } else { //$company->applyDiscount(.5);