<?php

namespace App\Console\Channel;

use Illuminate\Console\Command;
use App\Services\Channel\ChannelUserService;

class RegisterChannelUser extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'user:register {account} {password}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '注册用户';

    private $channelUserService;

    public function __construct(
        ChannelUserService $channelUserService
    )
    {
        parent::__construct();
        $this->channelUserService = $channelUserService;
    }

    public function handle()
    {
        // 传参
        $account  = trim($this->argument('account'));
        $password = trim($this->argument('password'));

        // 注册
        $res = $this->channelUserService->register($account, $password);
        dd($account, $password, $res);
    }
}