diff --git a/app/Console/Commands/AdminCreate.php b/app/Console/Commands/AdminCreate.php deleted file mode 100644 index 8782d28..0000000 --- a/app/Console/Commands/AdminCreate.php +++ /dev/null @@ -1,48 +0,0 @@ -ask('Name ?'); - $email = $this->ask('Email ?'); - $password = $this->secret('What is the password?'); - - $user = new User([ - 'name' => $name, - 'email' => $email, - 'role' => $role, - 'password' => Hash::make($password) - ]); - $user->saveOrFail(); - - $this->info('Admin created.'); - return 0; - } -} diff --git a/app/Console/Commands/UserCreate.php b/app/Console/Commands/UserCreate.php new file mode 100644 index 0000000..b6ec29b --- /dev/null +++ b/app/Console/Commands/UserCreate.php @@ -0,0 +1,47 @@ +ask('What is the name?'); + $email = $this->ask('What is the email?'); + $role = $this->ask('What is the role 1 (SuperAdmin) or 2 (Admin) ?') == '1' ? 1 : 2; + $pwd = $this->secret('What is the password?'); + + $user = new User(); + $user->name = $name; + $user->email = $email; + $user->role = $role; + $user->password = Hash::make($pwd); + $user->saveOrFail(); + + $this->info('User created.'); + return 0; + } +}