info('šŸ”— Testing Supabase Connection...\n'); try { // Test 1: Basic connection $this->info('Test 1: Basic Connection'); $pdo = DB::connection()->getPdo(); $this->line(' āœ… Connected to ' . env('DB_HOST')); // Test 2: Query execution $this->info('\nTest 2: Query Execution'); $result = DB::select('SELECT 1'); $this->line(' āœ… Query executed successfully'); // Test 3: Get database info $this->info('\nTest 3: Database Information'); $dbInfo = DB::select(" SELECT datname as database, version() as version FROM pg_database WHERE datname = current_database() "); if (!empty($dbInfo)) { $this->line(' Database: ' . $dbInfo[0]->database); $this->line(' Version: ' . $dbInfo[0]->version); } // Test 4: Tables $this->info('\nTest 4: Existing Tables'); $tables = DB::select(" SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' ORDER BY table_name "); if (empty($tables)) { $this->line(' āš ļø No tables found (run migrations)'); } else { $this->line(' āœ… Found ' . count($tables) . ' tables:'); foreach ($tables as $table) { $this->line(' - ' . $table->table_name); } } // Test 5: User count $this->info('\nTest 5: User Data'); $dosenCount = DB::table('users_dosen')->count(); $staffCount = DB::table('users_staff')->count(); $this->line(" Users Dosen: $dosenCount"); $this->line(" Users Staff: $staffCount"); $this->info('\nāœ… All tests passed! Supabase connection is working perfectly!'); return 0; } catch (\Exception $e) { $this->error('\nāŒ Connection Failed!'); $this->error('Error: ' . $e->getMessage()); $this->error('\nPlease check:'); $this->error('1. DB_HOST in .env'); $this->error('2. DB_USERNAME and DB_PASSWORD'); $this->error('3. DB_DATABASE name'); $this->error('4. IP whitelist in Supabase dashboard'); return 1; } } }