mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add trial days to account transformer
This commit is contained in:
parent
47768a70a4
commit
2c38a7d420
@ -491,4 +491,17 @@ class Account extends BaseModel
|
|||||||
->where('id', $this->decodePrimaryKey($value))->firstOrFail();
|
->where('id', $this->decodePrimaryKey($value))->firstOrFail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTrialDays()
|
||||||
|
{
|
||||||
|
if($this->payment_id)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
$plan_expires = Carbon::parse($this->plan_expires);
|
||||||
|
|
||||||
|
if(!$this->payment_id && $plan_expires->gt(now()))
|
||||||
|
return $plan_expires->diffInDays();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,8 @@ class AccountTransformer extends EntityTransformer
|
|||||||
'hosted_client_count' => (int) $account->hosted_client_count,
|
'hosted_client_count' => (int) $account->hosted_client_count,
|
||||||
'hosted_company_count' => (int) $account->hosted_company_count,
|
'hosted_company_count' => (int) $account->hosted_company_count,
|
||||||
'is_hosted' => (bool) Ninja::isHosted(),
|
'is_hosted' => (bool) Ninja::isHosted(),
|
||||||
'set_react_as_default_ap' => (bool) $account->set_react_as_default_ap
|
'set_react_as_default_ap' => (bool) $account->set_react_as_default_ap,
|
||||||
|
'trial_days_left' => Ninja::isHosted() ? (int) $account->getTrialDays() : 0,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,6 +111,5 @@ class AccountTransformer extends EntityTransformer
|
|||||||
|
|
||||||
return $this->includeItem(auth()->user(), $transformer, User::class);
|
return $this->includeItem(auth()->user(), $transformer, User::class);
|
||||||
|
|
||||||
// return $this->includeItem($account->default_company->owner(), $transformer, User::class);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user