command->error('ADMIN_EMAIL not configured in config/app.php or .env file'); return; } // Check if admin user already exists $existingAdmin = User::where('email', $adminEmail)->first(); if ($existingAdmin) { $this->command->info("Admin user with email {$adminEmail} already exists"); return; } // Ask for admin password $password = $this->command->secret('Enter admin password (input will be hidden):'); if (empty($password)) { $this->command->error('Password cannot be empty'); return; } // Confirm password $passwordConfirmation = $this->command->secret('Confirm admin password:'); if ($password !== $passwordConfirmation) { $this->command->error('Passwords do not match'); return; } User::query()->create([ 'name' => 'admin', 'email' => $adminEmail, 'password' => Hash::make($password), 'level' => UserLevel::SUPERADMIN, 'email_verified_at' => now(), ]); $this->command->info("Admin user created successfully with email: {$adminEmail}"); } }