mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-11 17:52:15 +01:00
Add more tests; Add filter in filament resource; Added options for user create command
This commit is contained in:
committed by
Constantin Graf
parent
84c9cfe2f2
commit
dce608e403
@@ -22,7 +22,8 @@ class UserCreateCommand extends Command
|
||||
protected $signature = 'admin:user:create
|
||||
{ name : The name of the user }
|
||||
{ email : The email of the user }
|
||||
{ --ask-for-password : Ask for the password, otherwise the command will generate a random one }';
|
||||
{ --ask-for-password : Ask for the password, otherwise the command will generate a random one }
|
||||
{ --verify-email : Verify the email address of the user }';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
@@ -39,6 +40,7 @@ class UserCreateCommand extends Command
|
||||
$name = $this->argument('name');
|
||||
$email = $this->argument('email');
|
||||
$askForPassword = (bool) $this->option('ask-for-password');
|
||||
$verifyEmail = (bool) $this->option('verify-email');
|
||||
|
||||
if (User::query()->where('email', $email)->where('is_placeholder', '=', false)->exists()) {
|
||||
$this->error('User with email "'.$email.'" already exists.');
|
||||
@@ -71,6 +73,10 @@ class UserCreateCommand extends Command
|
||||
throw new LogicException('User does not have an organization');
|
||||
}
|
||||
|
||||
if ($verifyEmail) {
|
||||
$user->markEmailAsVerified();
|
||||
}
|
||||
|
||||
$this->info('Created user "'.$name.'" ("'.$email.'")');
|
||||
$this->line('ID: '.$user->getKey());
|
||||
$this->line('Name: '.$name);
|
||||
|
||||
Reference in New Issue
Block a user