No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

64 líneas
1.2KB

  1. <?php
  2. namespace App\Console\Commands\QRCode;
  3. use App\Console\Commands\BaseCommand;
  4. use App\Logics\QRService\QRCryptoLogic;
  5. class サービス券暗号化 extends BaseCommand
  6. {
  7. const COMMAND = "qrcode:encrypto {input}";
  8. /**
  9. * The name and signature of the console command.
  10. *
  11. * @var string
  12. */
  13. protected $signature = self::COMMAND;
  14. /**
  15. * The console command description.
  16. *
  17. * @var string
  18. */
  19. protected $description = 'QRサービス券を暗号化する。';
  20. static public function getCommand()
  21. {
  22. return self::COMMAND;
  23. }
  24. /**
  25. * Create a new command instance.
  26. *
  27. * @return void
  28. */
  29. public function __construct()
  30. {
  31. parent::__construct();
  32. }
  33. /**
  34. * Execute the console command.
  35. *
  36. * @return int
  37. */
  38. public function service(): int
  39. {
  40. $input = $this->argument("input");
  41. if (!$input) {
  42. $this->outputError("入力エラー");
  43. return self::RESULTCODE_FAILED;
  44. }
  45. $result = QRCryptoLogic::encrypt($input);
  46. $this->outputInfo(sprintf("暗号化:[%s]->[%s]", $input, $result));
  47. return self::RESULTCODE_SUCCESS;
  48. }
  49. }