diff --git a/app/Models/Account.php b/app/Models/Account.php index 61643b68df..aff6a20ff0 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -1110,6 +1110,14 @@ class Account extends Eloquent return ! empty($plan_details); } + /** + * @return mixed + */ + public function hasActivePromo() + { + return $this->company->hasActivePromo(); + } + /** * @param null $plan_details * diff --git a/app/Models/Company.php b/app/Models/Company.php index 180b9ec615..de509d30e7 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -199,6 +199,10 @@ class Company extends Eloquent public function applyFreeYear() { + if ($this->plan_started && $this->plan_started != '0000-00-00') { + return; + } + $this->plan = PLAN_PRO; $this->plan_term = PLAN_TERM_YEARLY; $this->plan_price = PLAN_PRICE_PRO_MONTHLY; diff --git a/app/Models/User.php b/app/Models/User.php index bdc21dcdcf..830e498ec5 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -132,6 +132,14 @@ class User extends Authenticatable return $this->account->isPro(); } + /** + * @return mixed + */ + public function hasActivePromo() + { + return $this->account->hasActivePromo(); + } + /** * @param $feature * diff --git a/resources/views/header.blade.php b/resources/views/header.blade.php index eea95a1d62..e3ae6dd360 100644 --- a/resources/views/header.blade.php +++ b/resources/views/header.blade.php @@ -470,7 +470,9 @@
@if (Utils::isNinjaProd()) - @if (Auth::check() && Auth::user()->isTrial()) + @if (Auth::check() && Auth::user()->hasActivePromo()) + Your promotion will expire soon, click here to upgrade now. + @elseif (Auth::check() && Auth::user()->isTrial()) {!! trans(Auth::user()->account->getCountTrialDaysLeft() == 0 ? 'texts.trial_footer_last_day' : 'texts.trial_footer', [ 'count' => Auth::user()->account->getCountTrialDaysLeft(), 'link' => '' . trans('texts.click_here') . ''