2025-12-29 18:05:21 +06:00

42 lines
833 B
PHP

<?php
namespace App\Console\Commands;
use App\Models\User;
use Illuminate\Console\Command;
class CreateUser extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'user:create';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Create a new user';
/**
* Execute the console command.
*/
public function handle()
{
$name = $this->ask('Name');
$email = $this->ask('Email');
$password = $this->secret('Password');
$user = User::create([
'name' => $name,
'email' => $email,
'password' => bcrypt($password),
]);
$this->info("User {$user->email} created successfully.");
}
}