Deploy Ladill Queue / deploy (push) Successful in 56s
Phases 1–6: tickets, counters, displays, appointments, workflows, rules, analytics, reports, feedback, admin, device API, and Gitea deploy workflow for queue.ladill.com. Co-authored-by: Cursor <cursoragent@cursor.com>
43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Qms;
|
|
|
|
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
|
|
{
|
|
return config('qms.plans.'.$this->plan($organization).'.max_branches');
|
|
}
|
|
|
|
public function maxQueues(Organization $organization): ?int
|
|
{
|
|
return config('qms.plans.'.$this->plan($organization).'.max_queues');
|
|
}
|
|
|
|
public function canAddBranch(Organization $organization, int $currentCount): bool
|
|
{
|
|
$max = $this->maxBranches($organization);
|
|
|
|
return $max === null || $currentCount < $max;
|
|
}
|
|
|
|
public function canAddQueue(Organization $organization, int $currentCount): bool
|
|
{
|
|
$max = $this->maxQueues($organization);
|
|
|
|
return $max === null || $currentCount < $max;
|
|
}
|
|
}
|