Deploy Ladill Care / deploy (push) Failing after 13s
Healthcare management app: patients, appointments, consultations, lab, pharmacy inventory, billing, and reports at care.ladill.com. Co-authored-by: Cursor <cursoragent@cursor.com>
38 lines
879 B
PHP
38 lines
879 B
PHP
<?php
|
|
|
|
namespace App\Services\Care;
|
|
|
|
use App\Models\Organization;
|
|
|
|
class PlanService
|
|
{
|
|
public function plan(Organization $organization): string
|
|
{
|
|
return (string) data_get($organization->settings, 'plan', 'free');
|
|
}
|
|
|
|
public function isPro(Organization $organization): bool
|
|
{
|
|
return $this->plan($organization) === 'pro';
|
|
}
|
|
|
|
public function maxBranches(Organization $organization): ?int
|
|
{
|
|
$plan = config('care.plans.'.$this->plan($organization));
|
|
|
|
return $plan['max_branches'] ?? null;
|
|
}
|
|
|
|
public function canAddBranch(Organization $organization, int $currentCount): bool
|
|
{
|
|
$max = $this->maxBranches($organization);
|
|
|
|
return $max === null || $currentCount < $max;
|
|
}
|
|
|
|
public function proPriceMinor(): int
|
|
{
|
|
return (int) config('care.plans.pro.price_minor', 15000);
|
|
}
|
|
}
|