Keep Care org onboarded during demo login reseed.
Deploy Ladill Care / deploy (push) Successful in 1m19s

Avoid the onboarding flash when reset-on-login deletes the tenant before the afterResponse() reseed finishes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-17 19:29:09 +00:00
co-authored by Cursor
parent a3521247e0
commit 2c2cc1e938
2 changed files with 41 additions and 2 deletions
+16 -2
View File
@@ -249,14 +249,28 @@ class DemoTenantSeeder
DB::table('care_practitioner_schedules')->where('owner_ref', $ownerRef)->delete();
DB::table('care_practitioners')->where('owner_ref', $ownerRef)->delete();
DB::table('care_members')->where('owner_ref', $ownerRef)->delete();
// Keep the owner member + organization so SSO redirects never see
// "not onboarded" while afterResponse() reseeding is still running.
DB::table('care_members')
->where('owner_ref', $ownerRef)
->where('user_ref', '!=', $ownerRef)
->delete();
DB::table('care_departments')->where('owner_ref', $ownerRef)->delete();
DB::table('care_branches')->where('owner_ref', $ownerRef)->delete();
DB::table('care_messaging_credentials')->where('owner_ref', $ownerRef)->delete();
DB::table('care_payment_gateway_settings')->where('owner_ref', $ownerRef)->delete();
DB::table('care_audit_logs')->where('owner_ref', $ownerRef)->delete();
DB::table('care_organizations')->where('owner_ref', $ownerRef)->delete();
$organization = Organization::withTrashed()->where('owner_ref', $ownerRef)->first();
if ($organization) {
if ($organization->trashed()) {
$organization->restore();
}
$settings = $organization->settings ?? [];
$settings['onboarded'] = true;
$organization->forceFill(['settings' => $settings])->save();
}
}
/**