Skip to content

Commit

Permalink
Allow passing email and password directly on the command line
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Ribeiro authored and ifox committed Apr 27, 2021
1 parent efac9ff commit 812331d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Commands/CreateSuperAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CreateSuperAdmin extends Command
*
* @var string
*/
protected $signature = 'twill:superadmin';
protected $signature = 'twill:superadmin {email?} {password?}';

/**
* The console command description.
Expand Down Expand Up @@ -76,6 +76,9 @@ public function handle()
*/
private function setEmail()
{
if (filled($email = $this->argument('email'))) {
return $email;
}
$email = $this->ask('Enter an email');
if ($this->validateEmail($email)) {
return $email;
Expand All @@ -92,6 +95,9 @@ private function setEmail()
*/
private function setPassword()
{
if (filled($email = $this->argument('password'))) {
return $email;
}
$password = $this->secret('Enter a password');
if ($this->validatePassword($password)) {
$confirmPassword = $this->secret('Confirm the password');
Expand Down

0 comments on commit 812331d

Please sign in to comment.