This commit is contained in:
Saeed Vaziry
2023-07-09 22:32:22 +02:00
parent c1056f11ec
commit 71c918f435
3 changed files with 27 additions and 36 deletions

View File

@ -8,19 +8,18 @@
class CreateUserCommand extends Command
{
protected $signature = 'user:create {name} {email}';
protected $signature = 'user:create {name} {email} {password}';
protected $description = 'Create a new user';
public function handle(): void
{
$password = Str::random(20);
User::create([
'name' => $this->argument('name'),
'email' => $this->argument('email'),
'password' => bcrypt($password),
'password' => bcrypt($this->argument('password')),
]);
$this->info("User created with password: {$password}");
$this->info("User created with password");
}
}