";
echo "";
echo "
";
echo "🔍 Comprehensive Debug - SIM-PKPPS
";
echo "Waktu: " . date('Y-m-d H:i:s') . "
";
// Test 1: Laravel Files
echo "";
echo "
1. File Existence Check
";
$files = [
'Controller' => __DIR__ . '/sim-pkpps/app/Http/Controllers/Admin/UserController.php',
'Routes' => __DIR__ . '/sim-pkpps/routes/web.php',
'View Wali' => __DIR__ . '/sim-pkpps/resources/views/admin/users/wali_accounts.blade.php',
'API Controller' => __DIR__ . '/sim-pkpps/app/Http/Controllers/Api/ApiAuthController.php',
'Flutter Config' => __DIR__ . '/sim_mobile/lib/core/config/app_config.dart',
];
foreach ($files as $name => $path) {
if (file_exists($path)) {
echo "✅ {$name}: EXISTS - Modified: " . date('Y-m-d H:i:s', filemtime($path)) . "
";
} else {
echo "❌ {$name}: NOT FOUND
";
}
}
echo "";
// Test 2: Routes Content
echo "";
echo "
2. Routes Check
";
$routesFile = __DIR__ . '/sim-pkpps/routes/web.php';
if (file_exists($routesFile)) {
$content = file_get_contents($routesFile);
$checks = [
'wali_destroy route' => "name('wali_destroy')",
'wali_reset_password route' => "name('wali_reset_password')",
'POST delete method' => "post('wali/{userId}/delete'",
'POST reset method' => "post('wali/{userId}/reset-password'"
];
foreach ($checks as $desc => $needle) {
if (strpos($content, $needle) !== false) {
echo "✅ {$desc}: FOUND
";
} else {
echo "❌ {$desc}: NOT FOUND
";
}
}
}
echo "";
// Test 3: View File Check
echo "";
echo "
3. View File Check (wali_accounts.blade.php)
";
$viewFile = __DIR__ . '/sim-pkpps/resources/views/admin/users/wali_accounts.blade.php';
if (file_exists($viewFile)) {
$content = file_get_contents($viewFile);
$checks = [
'Delete button' => "route('admin.users.wali_destroy'",
'Reset button' => "route('admin.users.wali_reset_password'",
'CSRF token' => '@csrf',
'User ID parameter' => '$user->id',
];
foreach ($checks as $desc => $needle) {
if (strpos($content, $needle) !== false) {
echo "✅ {$desc}: FOUND
";
} else {
echo "❌ {$desc}: NOT FOUND
";
}
}
echo "
Last modified: " . date('Y-m-d H:i:s', filemtime($viewFile));
}
echo "";
// Test 4: Controller Methods
echo "";
echo "
4. Controller Methods Check
";
$controllerFile = __DIR__ . '/sim-pkpps/app/Http/Controllers/Admin/UserController.php';
if (file_exists($controllerFile)) {
$content = file_get_contents($controllerFile);
$checks = [
'destroyAccount method' => 'public function destroyAccount(string $role, string $userId)',
'resetPassword method' => 'public function resetPassword(string $role, string $userId)',
'User::findOrFail in destroy' => 'User::findOrFail($userId)',
];
foreach ($checks as $desc => $needle) {
if (strpos($content, $needle) !== false) {
echo "✅ {$desc}: FOUND
";
} else {
echo "❌ {$desc}: NOT FOUND
";
}
}
}
echo "";
// Test 5: Flutter Config
echo "";
echo "
5. Flutter Configuration
";
$flutterConfig = __DIR__ . '/sim_mobile/lib/core/config/app_config.dart';
if (file_exists($flutterConfig)) {
$content = file_get_contents($flutterConfig);
if (strpos($content, 'TugasAkhir/sim-pkpps/public/api/v1') !== false) {
echo "✅
Base URL: CORRECT (includes TugasAkhir path)";
} else {
echo "❌
Base URL: INCORRECT (missing TugasAkhir path)";
}
echo "
Current URL in file:";
preg_match('/baseUrl = \'(.+?)\'/s', $content, $matches);
if (isset($matches[1])) {
echo "
" . htmlspecialchars($matches[1]) . "
";
}
}
echo "
";
// Test 6: API Test
echo "";
echo "
6. API Login Test
";
$apiUrl = 'http://localhost/TugasAkhir/sim-pkpps/public/api/v1/login';
$data = json_encode([
'id_santri' => 'Aydin Fauzan',
'password' => 's002'
]);
$options = [
'http' => [
'header' => "Content-Type: application/json\r\nAccept: application/json\r\n",
'method' => 'POST',
'content' => $data,
'ignore_errors' => true
],
];
$context = stream_context_create($options);
$result = @file_get_contents($apiUrl, false, $context);
if ($result !== false) {
$response = json_decode($result, true);
if (isset($response['success']) && $response['success']) {
echo "✅
API Login: SUCCESS";
echo "
Token: " . substr($response['token'], 0, 20) . "...
";
echo "
User: " . $response['user']['name'] . "
";
echo "
Role: " . $response['user']['role'] . "
";
} else {
echo "❌
API Login: FAILED";
echo "
" . htmlspecialchars(print_r($response, true)) . "
";
}
} else {
echo "❌
API: CANNOT CONNECT";
}
echo "
";
// Test 7: Database Check
echo "";
echo "
7. Database Wali Accounts
";
$dbFile = __DIR__ . '/sim-pkpps/.env';
if (file_exists($dbFile)) {
echo "✅
.env file exists";
echo "
⚠️ Untuk cek database, gunakan phpMyAdmin atau Tinker
";
echo "
php artisan tinker --execute=\"echo App\\Models\\User::where('role','wali')->count();\"";
} else {
echo "❌
.env file not found";
}
echo "
";
// Summary
echo "
";
echo "
📋 Summary & Next Steps
";
echo "
";
echo "- Clear Browser Cache: Ctrl+Shift+R atau Ctrl+F5
";
echo "- Login ke Admin: Login Admin
";
echo "- Test Wali Accounts: Wali Accounts
";
echo "- Flutter: Hot Restart (bukan Hot Reload)
";
echo "- Test Login Mobile: Username=
Aydin Fauzan, Password=s002 ";
echo "
";
echo "
";
echo "
Generated at " . date('Y-m-d H:i:s') . "
";
echo "