vito/app/Console/Commands/CreateUserCommand.php
Saeed Vaziry e1eb42059f code style fix
add command tests
2023-09-02 16:41:42 +02:00

25 lines
551 B
PHP

<?php
namespace App\Console\Commands;
use App\Models\User;
use Illuminate\Console\Command;
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');
}
}