<?php



use Illuminate\Support\Facades\Hash;
use App\Models\User;

Route::get('/create-admin', function () {
    $email = 'admin3@i2fconseil.ma';
    
    // Vérifier si utilisateur existe
    $user = User::where('email', $email)->first();

    if ($user) {
        return "User already exists with email: {$email}";
    }

    // Créer nouvel utilisateur admin
    $user = User::create([
        'nom' => 'Admin',
        'prenom' => 'Admin',
        'cin' => 'XX00000',
        'email' => $email,
        'password' => Hash::make('admin'), // mot de passe = 'admin'
        'role' => 'Admin',
        'telephone' => '0000000000'
    ]);

    return "Admin user created with email {$email} and password 'admin'";
});

