make(Kernel::class)->bootstrap(); portalQaAssertTarget($target); config(['portal.managers' => ['opportunity-manager@example.invalid', 'geo-manager-qa@example.invalid']]); $db = DB::connection(); $db->beginTransaction(); $db->statement('SET TRANSACTION READ ONLY'); try { $proof = ['target' => $target, 'tables' => [], 'opportunities' => [], 'accounts' => [], 'active_writes' => 0]; foreach (['opportunity_projects', 'opportunity_clusters', 'opportunity_images', 'opportunity_documents', 'opportunity_locations', 'documents', 'desk_cases', 'desk_requests', 'desk_documents', 'investor_journeys', 'journey_steps', 'tasks', 'questionnaire_versions', 'geo_locations', 'geo_geometries'] as $table) { if (! Schema::hasTable($table)) { continue; } $rows = $db->select('SELECT row_to_json(t)::text AS row FROM "'.$table.'" t ORDER BY row_to_json(t)::text'); $proof['tables'][$table] = ['rows' => count($rows), 'sha256' => hash('sha256', implode("\n", array_column($rows, 'row')))]; } foreach ($db->select('SELECT id,row_to_json(t)::text AS row FROM opportunities t ORDER BY id') as $row) { $proof['opportunities'][$row->id] = hash('sha256', $row->row); } $proof['published'] = Opportunity::published()->count(); foreach (User::whereIn('email', config('portal.managers'))->orWhereIn('id', [13, 18])->get() as $user) { $proof['accounts'][] = ['id' => $user->id, 'manage_portal' => $user->can('manage-portal'), 'email_verified' => $user->hasVerifiedEmail(), 'mfa_configured' => (bool) $user->two_factor_secret]; } $proof['account18_sha256'] = hash('sha256', json_encode($db->table('users')->where('id', 18)->first(), JSON_THROW_ON_ERROR)); } finally { $db->rollBack(); } echo json_encode($proof, JSON_THROW_ON_ERROR).PHP_EOL;