| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- namespace App\Module\Test\Commands;
- use Illuminate\Console\Command;
- /**
- * 测试Test模块的自动发现机制
- *
- * 这个命令没有在ServiceProvider中手动注册,用于验证自动发现是否工作
- */
- class TestAutoDiscoveryCommand extends Command
- {
- /**
- * 命令签名
- */
- protected $signature = 'test:auto-discovery {--count=5 : 要显示的数字数量}';
- /**
- * 命令描述
- */
- protected $description = '测试Test模块的命令自动发现机制 - 此命令未手动注册';
- /**
- * 执行命令
- */
- public function handle(): int
- {
- $count = (int) $this->option('count');
-
- $this->info('🚀 Test模块自动发现机制测试');
- $this->line('');
-
- $this->info("✨ 这个命令没有在ServiceProvider中手动注册!");
- $this->info("🔍 如果您能看到这条消息,说明自动发现机制工作正常!");
-
- $this->line('');
- $this->comment("生成 {$count} 个随机数字:");
-
- for ($i = 1; $i <= $count; $i++) {
- $number = rand(1, 100);
- $this->line(" {$i}. {$number}");
- }
-
- $this->line('');
- $this->info('🎉 Test模块命令自动发现机制测试成功!');
-
- return 0;
- }
- }
|