Gate Care branch management behind Pro like Frontdesk.
Deploy Ladill Care / deploy (push) Successful in 1m25s

Free plans keep a single setup branch but get an upgrade screen for Branches; Pro/Enterprise unlock multi-branch management via plan features.
This commit is contained in:
isaacclad
2026-07-16 09:14:58 +00:00
parent 0181c958f5
commit 85eb04d2a3
9 changed files with 185 additions and 8 deletions
@@ -3,6 +3,7 @@
namespace App\Http\Controllers\Care;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Care\Concerns\RequiresPlanFeature;
use App\Http\Controllers\Care\Concerns\ScopesToAccount;
use App\Models\Branch;
use App\Services\Care\AuditLogger;
@@ -13,11 +14,26 @@ use Illuminate\View\View;
class BranchController extends Controller
{
use RequiresPlanFeature;
use ScopesToAccount;
private const FEATURE = 'branches';
private const UPGRADE_MESSAGE = 'Multi-branch management requires Care Pro.';
public function index(Request $request): View
{
$this->authorizeAbility($request, 'admin.branches.view');
if ($upgrade = $this->proFeatureUpgradeView(
$request,
self::FEATURE,
'Branches',
'Manage clinic locations and sites with Care Pro. Free plans include one branch created during setup.',
)) {
return $upgrade;
}
$organization = $this->organization($request);
$branches = Branch::owned($this->ownerRef($request))
@@ -39,12 +55,26 @@ class BranchController extends Controller
{
$this->authorizeAbility($request, 'admin.branches.manage');
if ($upgrade = $this->proFeatureUpgradeView(
$request,
self::FEATURE,
'Branches',
'Add and manage multiple clinic locations with Care Pro.',
)) {
return $upgrade;
}
return view('care.admin.branches.create', ['organization' => $this->organization($request)]);
}
public function store(Request $request): RedirectResponse
{
$this->authorizeAbility($request, 'admin.branches.manage');
if ($deny = $this->denyWithoutFeature($request, self::FEATURE, self::UPGRADE_MESSAGE)) {
return $deny;
}
$organization = $this->organization($request);
$owner = $this->ownerRef($request);
@@ -83,6 +113,15 @@ class BranchController extends Controller
$this->authorizeAbility($request, 'admin.branches.manage');
$this->authorizeOwner($request, $branch);
if ($upgrade = $this->proFeatureUpgradeView(
$request,
self::FEATURE,
'Branches',
'Edit clinic locations with Care Pro. Free plans include one branch created during setup.',
)) {
return $upgrade;
}
return view('care.admin.branches.edit', compact('branch'));
}
@@ -91,6 +130,10 @@ class BranchController extends Controller
$this->authorizeAbility($request, 'admin.branches.manage');
$this->authorizeOwner($request, $branch);
if ($deny = $this->denyWithoutFeature($request, self::FEATURE, self::UPGRADE_MESSAGE)) {
return $deny;
}
$validated = $request->validate([
'name' => ['required', 'string', 'max:255'],
'code' => ['nullable', 'string', 'max:50'],