Fix dentistry demo seed scoping departments by branch.
Deploy Ladill Care / deploy (push) Successful in 52s

care_departments has no organization_id; match the Blood Bank seeder pattern so demo:seed no longer fails on dental specialty data.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-18 21:56:18 +00:00
co-authored by Cursor
parent ad3d8b5ce4
commit 9ecc3ad7f0
+10 -1
View File
@@ -1089,8 +1089,17 @@ class DemoTenantSeeder
private function seedDentistryClinicalDemo(Organization $organization, string $ownerRef): void
{
$departmentIds = Department::owned($ownerRef)
// Specialty departments are provisioned without organization_id; scope via branches.
$branchIds = Branch::owned($ownerRef)
->where('organization_id', $organization->id)
->pluck('id');
if ($branchIds->isEmpty()) {
return;
}
$departmentIds = Department::owned($ownerRef)
->whereIn('branch_id', $branchIds)
->where('type', 'dental')
->where('is_active', true)
->pluck('id');