diff --git a/app/Jobs/Account/CreateAccount.php b/app/Jobs/Account/CreateAccount.php index ec24b4f6122f..86458d904b0b 100644 --- a/app/Jobs/Account/CreateAccount.php +++ b/app/Jobs/Account/CreateAccount.php @@ -77,6 +77,9 @@ class CreateAccount $sp794f3f->save(); + if(Ninja::isHosted()) + $sp794f3f->startTrial(); + $sp035a66 = CreateCompany::dispatchNow($this->request, $sp794f3f); $sp035a66->load('account'); $sp794f3f->default_company_id = $sp035a66->id; diff --git a/app/Models/Account.php b/app/Models/Account.php index ddb97dd9075c..c062ef6dbf54 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -227,6 +227,21 @@ class Account extends BaseModel return $plan_details && $plan_details['trial']; } + public function startTrial($plan) + { + if (! Ninja::isNinja()) { + return; + } + + if ($this->trial_started && $this->trial_started != '0000-00-00') { + return; + } + + $this->trial_plan = $plan; + $this->trial_started = now(); + $this->save(); + } + public function getPlanDetails($include_inactive = false, $include_trial = true) { $plan = $this->plan; diff --git a/app/Transformers/ActivityTransformer.php b/app/Transformers/ActivityTransformer.php index d9000135881b..a284f0489829 100644 --- a/app/Transformers/ActivityTransformer.php +++ b/app/Transformers/ActivityTransformer.php @@ -36,6 +36,7 @@ class ActivityTransformer extends EntityTransformer 'id' => (string) $this->encodePrimaryKey($activity->id), 'activity_type_id' => (string) $activity->activity_type_id, 'client_id' => $activity->client_id ? (string) $this->encodePrimaryKey($activity->client_id) : '', + 'recurring_invoice_id' => $activity->recurring_invoice_id ? (string) $this->encodePrimaryKey($activity->recurring_invoice_id) : '', 'company_id' => $activity->company_id ? (string) $this->encodePrimaryKey($activity->company_id) : '', 'user_id' => (string) $this->encodePrimaryKey($activity->user_id), 'invoice_id' => $activity->invoice_id ? (string) $this->encodePrimaryKey($activity->invoice_id) : '', diff --git a/resources/views/portal/ninja2020/components/livewire/subscriptions-recurring-invoices-table.blade.php b/resources/views/portal/ninja2020/components/livewire/subscriptions-recurring-invoices-table.blade.php index d09928a13366..c744bfce27e1 100644 --- a/resources/views/portal/ninja2020/components/livewire/subscriptions-recurring-invoices-table.blade.php +++ b/resources/views/portal/ninja2020/components/livewire/subscriptions-recurring-invoices-table.blade.php @@ -40,6 +40,8 @@ {{ ctrans('texts.date') }}
+