neonail-database/check-admin-user.php
2025-08-10 18:09:07 +02:00

54 lines
1.7 KiB
PHP
Executable File

<?php
// Admin-User Status prüfen
require_once 'vendor/autoload.php';
use App\Models\User;
try {
// Laravel App initialisieren
$app = require_once 'bootstrap/app.php';
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();
echo "<h1>🔍 Admin-User Status</h1>";
// Alle User anzeigen
$users = User::all();
if ($users->count() > 0) {
echo "<h2>✅ Benutzer gefunden:</h2>";
echo "<table border='1' style='border-collapse: collapse;'>";
echo "<tr><th>ID</th><th>Name</th><th>Email</th><th>Erstellt</th></tr>";
foreach ($users as $user) {
echo "<tr>";
echo "<td>{$user->id}</td>";
echo "<td>{$user->name}</td>";
echo "<td>{$user->email}</td>";
echo "<td>{$user->created_at}</td>";
echo "</tr>";
}
echo "</table>";
// Admin-User finden
$admin = User::where('email', 'admin@neonail.com')->first();
if ($admin) {
echo "<h2>👑 Admin-User gefunden:</h2>";
echo "<p><strong>Name:</strong> {$admin->name}</p>";
echo "<p><strong>Email:</strong> {$admin->email}</p>";
echo "<p><strong>ID:</strong> {$admin->id}</p>";
}
} else {
echo "<h2>❌ Keine Benutzer gefunden</h2>";
echo "<p>Bitte Admin-User erstellen:</p>";
echo "<code>php artisan tinker</code><br>";
echo "<code>use App\Models\User;</code><br>";
echo "<code>User::create(['name' => 'Admin', 'email' => 'admin@neonail.com', 'password' => bcrypt('ihr_passwort')]);</code>";
}
} catch (Exception $e) {
echo "<h2>❌ Fehler:</h2>";
echo "<p>{$e->getMessage()}</p>";
}
?>