Tighten Pro alert caps and move custom badges to Enterprise.
Deploy Ladill Frontdesk / deploy (push) Has been cancelled
Deploy Ladill Frontdesk / deploy (push) Has been cancelled
Pro includes 5,000 email and 5,000 SMS host alerts per month with hard monthly caps; Enterprise is unlimited. Custom badge templates are Enterprise-only, and plan benefit copy matches the new limits.
This commit is contained in:
@@ -49,7 +49,10 @@ class PlanService
|
||||
];
|
||||
}
|
||||
|
||||
/** Null means unlimited included host emails (Pro / Enterprise). */
|
||||
/**
|
||||
* Included host emails per calendar month.
|
||||
* Null means unlimited (Enterprise). Free/Pro use finite allowances.
|
||||
*/
|
||||
public function freeEmailsPerMonth(Organization $organization): ?int
|
||||
{
|
||||
$value = config('frontdesk.plans.'.$this->planKey($organization).'.free_emails_per_month', 100);
|
||||
@@ -57,6 +60,44 @@ class PlanService
|
||||
return $value === null ? null : (int) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Included host SMS per calendar month.
|
||||
* Null means unlimited (Enterprise). 0 means none included.
|
||||
*/
|
||||
public function freeSmsPerMonth(Organization $organization): ?int
|
||||
{
|
||||
$plan = (array) config('frontdesk.plans.'.$this->planKey($organization), []);
|
||||
if (! array_key_exists('free_sms_per_month', $plan)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$value = $plan['free_sms_per_month'];
|
||||
|
||||
return $value === null ? null : (int) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paid plans with a finite allowance stop sending once the monthly cap is hit.
|
||||
* Free keeps pay-as-you-go after its free email allowance.
|
||||
*/
|
||||
public function emailAllowanceExhausted(Organization $organization, int $sentThisMonth): bool
|
||||
{
|
||||
$allowance = $this->freeEmailsPerMonth($organization);
|
||||
|
||||
return $this->hasPaidPlan($organization)
|
||||
&& $allowance !== null
|
||||
&& $sentThisMonth >= $allowance;
|
||||
}
|
||||
|
||||
public function smsAllowanceExhausted(Organization $organization, int $sentThisMonth): bool
|
||||
{
|
||||
$allowance = $this->freeSmsPerMonth($organization);
|
||||
|
||||
return $this->hasPaidPlan($organization)
|
||||
&& $allowance !== null
|
||||
&& $sentThisMonth >= $allowance;
|
||||
}
|
||||
|
||||
public function activeBranchCount(Organization $organization): int
|
||||
{
|
||||
return Branch::query()
|
||||
|
||||
Reference in New Issue
Block a user