@if(config('app.debug') && request()->has('debug')) @php $currentDbName = config('database.connections.mysql.database'); $dbConnectionStatus = 'Connected'; $dbStatusColor = '#4ade80'; try { \Illuminate\Support\Facades\DB::connection('mysql')->getPdo(); } catch (\Throwable $e) { $dbConnectionStatus = 'Error: ' . $e->getMessage(); $dbStatusColor = '#f87171'; } $currentHost = request()->getHost() ?: ($_SERVER['HTTP_HOST'] ?? 'Unknown'); $subdomainSlug = null; $wbClient = null; try { $pathSegment = request()->segment(1); $hostParts = explode('.', $currentHost); $reservedHosts = ['www', 'checkout', 'admin', 'localhost', 'websitebuilder', 'website-builder', 'launchshop']; if (count($hostParts) > 2 && !in_array(strtolower($hostParts[0]), $reservedHosts)) { $subdomainSlug = $hostParts[0]; } elseif ($pathSegment && !in_array(strtolower($pathSegment), ['admin', 'checkout', 'membership', 'login', 'register', 'assets', 'api', 'pricing', 'templates'])) { $subdomainSlug = $pathSegment; } if (\Illuminate\Support\Facades\Schema::hasTable('wb_customers')) { if ($subdomainSlug) { $wbClient = \App\Models\WebsiteBuilder\WbCustomer::where('subdomain', $subdomainSlug)->first(); } if (!$wbClient && session('wb_customer_id')) { $wbClient = \App\Models\WebsiteBuilder\WbCustomer::find(session('wb_customer_id')); } } if (!$wbClient && \Illuminate\Support\Facades\Schema::hasTable('users')) { $lsUser = null; if ($subdomainSlug) { $lsUser = \App\Models\User::where('username', $subdomainSlug)->first(); } if (!$lsUser && session('new_user_username')) { $lsUser = \App\Models\User::where('username', session('new_user_username'))->first(); } if ($lsUser) { $wbClient = (object)[ 'company_name' => $lsUser->shop_name ?: ($lsUser->first_name ?: $lsUser->username), 'username' => $lsUser->username, 'email' => $lsUser->email, ]; } } } catch (\Throwable $e) {} $resolvedUser = null; try { $resolvedUser = function_exists('getUser') ? getUser() : null; } catch (\Throwable $e) {} $userLabel = $resolvedUser ? ($resolvedUser->username ?? $resolvedUser->email ?? 'Resolved') : 'None'; @endphp
Active DB: {{ $currentDbName }}
Host: {{ $currentHost }}{{ $subdomainSlug ? ' (' . $subdomainSlug . ')' : '' }}
DB Status: {{ $dbConnectionStatus }}
Client: @if($wbClient) {{ $wbClient->company_name ?? $wbClient->username }} ({{ $wbClient->email }}) @elseif($subdomainSlug) No Client Record for '{{ $subdomainSlug }}' @else {{ $userLabel }} @endif
@endif