Add Care Pro billing, renewal, and scheduler.
Deploy Ladill Care / deploy (push) Successful in 35s

Organizations can subscribe from wallet, expire correctly on free tier, and renew nightly via care:pro-renew.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-30 01:07:23 +00:00
co-authored by Cursor
parent cd415e918f
commit 4bc485dfea
10 changed files with 403 additions and 4 deletions
+18 -3
View File
@@ -3,22 +3,37 @@
namespace App\Services\Care;
use App\Models\Organization;
use Carbon\Carbon;
class PlanService
{
public function planKey(Organization $organization): string
{
$settings = $organization->settings ?? [];
$plan = (string) ($settings['plan'] ?? 'free');
if ($plan === 'pro' && ! empty($settings['plan_expires_at'])) {
if (Carbon::parse($settings['plan_expires_at'])->isPast()) {
return 'free';
}
}
return array_key_exists($plan, config('care.plans', [])) ? $plan : 'free';
}
public function plan(Organization $organization): string
{
return (string) data_get($organization->settings, 'plan', 'free');
return $this->planKey($organization);
}
public function isPro(Organization $organization): bool
{
return $this->plan($organization) === 'pro';
return $this->planKey($organization) === 'pro';
}
public function maxBranches(Organization $organization): ?int
{
$plan = config('care.plans.'.$this->plan($organization));
$plan = config('care.plans.'.$this->planKey($organization));
return $plan['max_branches'] ?? null;
}