info('Creating admin account...'); $name = $this->ask('Enter name'); $email = $this->ask('Enter email'); $password = $this->secret('Enter password'); try { $findByEmail = \App\Models\User::where('email', $email)->first(); if ($findByEmail) { $this->error('Admin account with this email already exists'); return; } $admin = new \App\Models\User(); $admin->name = $name; $admin->email = $email; $admin->password = Hash::make($password); $admin->save(); } catch (\Exception $e) { $this->error('Failed to create admin account'); $this->error($e->getMessage()); return; } $this->info('Admin account created successfully'); } }