";
// 1. Manually delete the bootstrap cache files
$cachePath = __DIR__ . '/../bootstrap/cache/';
if (is_dir($cachePath)) {
$files = ['routes-v7.php', 'config.php', 'services.php', 'packages.php', 'events.php'];
foreach ($files as $file) {
if (file_exists($cachePath . $file)) {
@unlink($cachePath . $file);
echo "Deleted cache: $file
";
}
}
}
// 2. Fix Storage Link
$link = __DIR__ . '/storage';
$target = __DIR__ . '/../storage/app/public';
if (!file_exists($link)) {
@symlink($target, $link);
echo "Storage link processed.
";
}
// 3. Bootstrap Laravel to reset password and run Artisan
try {
if (!file_exists(__DIR__ . '/../vendor/autoload.php')) {
die("Error: vendor/autoload.php not found. Did you run composer install?");
}
require __DIR__ . '/../vendor/autoload.php';
$app = require_once __DIR__ . '/../bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$kernel->bootstrap();
// Reset company@example.com password
$user = \App\Models\User::where('email', 'company@example.com')->first();
if ($user) {
$user->password = \Illuminate\Support\Facades\Hash::make('password');
$user->save();
echo "SUCCESS: Password for company@example.com reset to 'password'.
";
}
// Clear optimize
\Artisan::call('optimize:clear');
echo "Global optimize:clear finished.
";
echo "
---
Done! You should now be able to login with password.";
echo "
⚠️ DELETE THIS FILE (public/sync.php) FROM YOUR SERVER NOW!";
} catch (\Exception $e) {
echo "
BOOTSTRAP ERROR: " . $e->getMessage() . "
";
echo "File: " . $e->getFile() . " on line " . $e->getLine();
echo "
This usually happens if your Controller files have syntax errors or if the database connection failed.";
}