Files
HRM-System/public/repair-debug.php
2026-04-22 11:30:31 +08:00

44 lines
1.3 KiB
PHP

<?php
/**
* DEBUG SCRIPT
*/
define('LARAVEL_START', microtime(true));
require __DIR__.'/../vendor/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
echo "<h1>Debug Info</h1>";
echo "<ul>";
echo "<li>APP_ENV: " . app()->environment() . "</li>";
echo "<li>APP_URL: " . config('app.url') . "</li>";
echo "<li>SECURE: " . (request()->isSecure() ? 'Yes' : 'No') . "</li>";
echo "<li>URL helper test: " . url('/test-path') . "</li>";
echo "</ul>";
echo "<h2>Helper Tests</h2><ul>";
try {
if (auth()->check()) {
echo "<li>Testing for User ID: " . auth()->id() . "</li>";
$start = microtime(true);
$companyId = getCompanyId(auth()->id());
$end = microtime(true);
echo "<li>getCompanyId result: " . ($companyId ?? 'null') . " (Time: " . round($end - $start, 4) . "s)</li>";
$start = microtime(true);
$ids = getCompanyAndUsersId();
$end = microtime(true);
echo "<li>getCompanyAndUsersId count: " . count($ids) . " (Time: " . round($end - $start, 4) . "s)</li>";
} else {
echo "<li>User not authenticated. Login first to test helpers.</li>";
}
} catch (Exception $e) {
echo "<li>❌ Error: " . $e->getMessage() . "</li>";
}
echo "</ul>";
echo "<h2>Headers</h2><pre>";
print_r(request()->headers->all());
echo "</pre>";