vito/app/Console/Commands/CreateUserCommand.php
Saeed Vaziry 71c918f435 fixes
2023-07-09 22:32:22 +02:00

26 lines
579 B
PHP

<?php
namespace App\Console\Commands;
use App\Models\User;
use Illuminate\Console\Command;
use Illuminate\Support\Str;
class CreateUserCommand extends Command
{
protected $signature = 'user:create {name} {email} {password}';
protected $description = 'Create a new user';
public function handle(): void
{
User::create([
'name' => $this->argument('name'),
'email' => $this->argument('email'),
'password' => bcrypt($this->argument('password')),
]);
$this->info("User created with password");
}
}