Add education promotion

This commit is contained in:
Hillel Coren 2019-01-17 11:49:24 +02:00
parent 48c516ee4f
commit 56eb833d85
2 changed files with 5 additions and 5 deletions

View file

@ -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');
}
}

View file

@ -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);