Add more tests; Add filter in filament resource; Added options for user create command

This commit is contained in:
Constantin Graf
2025-02-05 18:02:24 -05:00
committed by Constantin Graf
parent 84c9cfe2f2
commit dce608e403
20 changed files with 413 additions and 12 deletions

View File

@@ -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);