66 lines
2.3 KiB
PHP
66 lines
2.3 KiB
PHP
<?php
|
|
// Neuen Admin-User erstellen
|
|
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>👑 Neuen Admin-User erstellen</h1>";
|
|
|
|
// Prüfe ob User bereits existiert
|
|
$email = 'neueradmin@neonail.com';
|
|
$existingUser = User::where('email', $email)->first();
|
|
|
|
if ($existingUser) {
|
|
echo "<h2>✅ User existiert bereits!</h2>";
|
|
echo "<p><strong>Name:</strong> {$existingUser->name}</p>";
|
|
echo "<p><strong>Email:</strong> {$existingUser->email}</p>";
|
|
echo "<p><strong>ID:</strong> {$existingUser->id}</p>";
|
|
echo "<p><strong>Erstellt:</strong> {$existingUser->created_at}</p>";
|
|
} else {
|
|
// Neuen Admin-User erstellen
|
|
$newAdmin = User::create([
|
|
'name' => 'Neuer Admin',
|
|
'email' => $email,
|
|
'password' => bcrypt('admin123')
|
|
]);
|
|
|
|
echo "<h2>✅ Neuer Admin-User erstellt!</h2>";
|
|
echo "<p><strong>Name:</strong> {$newAdmin->name}</p>";
|
|
echo "<p><strong>Email:</strong> {$newAdmin->email}</p>";
|
|
echo "<p><strong>Passwort:</strong> admin123</p>";
|
|
echo "<p><strong>ID:</strong> {$newAdmin->id}</p>";
|
|
}
|
|
|
|
// Alle Admin-User anzeigen
|
|
echo "<h2>👑 Alle Admin-User:</h2>";
|
|
$allUsers = User::all();
|
|
|
|
echo "<table border='1' style='border-collapse: collapse;'>";
|
|
echo "<tr><th>ID</th><th>Name</th><th>Email</th><th>Erstellt</th></tr>";
|
|
|
|
foreach ($allUsers 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>";
|
|
|
|
echo "<h2>🔑 Login-Daten:</h2>";
|
|
echo "<p><strong>Email:</strong> neueradmin@neonail.com</p>";
|
|
echo "<p><strong>Passwort:</strong> admin123</p>";
|
|
echo "<p><a href='https://neonail.vogt.de.com' style='background: #007bff; color: white; padding: 10px; text-decoration: none; border-radius: 5px;'>🚀 Zur Anwendung</a></p>";
|
|
|
|
} catch (Exception $e) {
|
|
echo "<h2>❌ Fehler:</h2>";
|
|
echo "<p>{$e->getMessage()}</p>";
|
|
}
|
|
?>
|