RegisterChannelUser.php 972 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace App\Console\Channel;
  3. use Illuminate\Console\Command;
  4. use App\Services\Channel\ChannelUserService;
  5. class RegisterChannelUser extends Command
  6. {
  7. /**
  8. * The name and signature of the console command.
  9. *
  10. * @var string
  11. */
  12. protected $signature = 'user:register {account} {password}';
  13. /**
  14. * The console command description.
  15. *
  16. * @var string
  17. */
  18. protected $description = '注册用户';
  19. private $channelUserService;
  20. public function __construct(
  21. ChannelUserService $channelUserService
  22. )
  23. {
  24. parent::__construct();
  25. $this->channelUserService = $channelUserService;
  26. }
  27. public function handle()
  28. {
  29. // 传参
  30. $account = trim($this->argument('account'));
  31. $password = trim($this->argument('password'));
  32. // 注册
  33. $res = $this->channelUserService->register($account, $password);
  34. dd($account, $password, $res);
  35. }
  36. }